[Qt-interest] QFileDialog not showing only dirs

Rui Maciel rui.maciel at gmail.com
Fri Nov 20 23:33:34 CET 2009


While tweaking an instance of QFileDialog on a pet project of mine I've noticed that although 
QFileDialog::getExistingDirectory() works as expected, the following code generates a regular file dialog:

<code>
        QFileDialog fd(this, tr("Select base directory"), base_dir);
        bool validatePage();
        fd.setFileMode(QFileDialog::Directory);
        fd.setOptions(QFileDialog::ShowDirsOnly);
        fd.setViewMode(QFileDialog::List);
        fd.exec();
</code>

Am I missing something or should this code really generate a dirs only file dialog?


Rui Maciel



More information about the Qt-interest-old mailing list