You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Friday, November 11th 2005, 3:20pm

select directories with QFileDialog (or in another way)


i am trying to use a QFileDialog to select some directories and save them as a QStringList. but so far i am only able to select one directory via getExistingDirectories or select Files. i need something like getExistingDirectories.

at least i tried this:

QStringList directories = QFileDialog::getOpenFileNames(
this, "Select Directories",
openDirectoriesPath, QFileDialog::ShowDirsOnly);

this gives me following error message:

mainwindow.cpp:112: error: no matching function for call to `QFileDialog::getOpenFileNames(MainWindow* const, const char[19], QString&, QFileDialog::Option)'
C:/qt/4.0.1/include/QtGui/../../src/gui/dialogs/qfiledialog.h:161: note: candidates are: static QStringList QFileDialog::getOpenFileNames(QWidget*, const QString&, const QString&, const QString&, QString*, QFlags<QFileDialog::Option>)


Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message


Friday, November 11th 2005, 4:56pm

You miss two parameters before the options

Qt/KDE Developer
Debian User


Monday, November 14th 2005, 10:37am

i did so but qt dont follow my option ShowDirsOnly and shows all. you can select many folders, but qt opens this automatically and shows the files.