How to launch a file browser in a Qt application?
I want to have a button that, when clicked, launches a file browser (like Ctrl + O in Word) and returns the path of the file that user opens.
I know how to make the button, but what should I do in the slot that responds to mouseClicked signal?
What you need to do is write this code in your mouse_click function !
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open File"),"/path/to/file/",tr("Mp3 Files (*.mp3)")); ui->listWidget->addItems(fileNames);
*.mp3 will display only mp3 files remove the tr("Mp3 Files (*.mp3)") if you dont want to filter any files