get a QList<QUrl> from folder
-
Hello,
I'm trying to get a list url of the mp3 file from a folder.
I have triedurlList=QFileDialog::getOpenFileUrls(nullptr,QString(),temp,"*.mp3",nullptr,QFileDialog::ShowDirsOnly);
but it still let me chose file instead of folder.
Is there any other way to do what I want? -
@NguyenMinh said in get a QList<QUrl> from folder:
but it still let me chose file instead of folder
Isn't that what you want to do: get a list of mp3 files? Or do you mean it lets you select directories?
If you want to select directory use https://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectoryUrl -
@NguyenMinh I really don't understand the problem: getOpenFileUrls opens a file dialog where you can navigate through all your directories and select files.
If you want to select a directory when opening the dialog then take a look at documentation: https://doc.qt.io/qt-5/qfiledialog.html#getOpenFileUrls - there is dir parameter for that.
If you want to know which directory user selected simply check the path of the first returned file URL - it will contain the whole path including the directory.