This fails for me. I can only select files. No way to select the directory without opening it up. The question was how to select a file, or a directory. This only selects files.
This fails for me. I can only select files. No way to select the directory without opening it up. The question was how to select a file, or a directory. This only selects files.
-- Doug Royer (https://DougRoyer.US)
If you are using the QFileDialog static methods, then you call QFileDialog::getExistingDirectory() to select directories only and QFileDialog::getOpenFileName() for files only. If you are using the non-static method (ie. via QFileDialog::exec()) than you set the option QFileDialog::ShowDirsOnly and use QFileDialog::Directory file mode.
The original post is 13 years old, during Qt 3 or Qt 4 days. Qt is three major revisions past that now.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks