The "Browse For Folder" Windows dialog is very inconvenient because:
Is there a way to use the "Open File" dialog (which is much better) to select a Folder? Some flag or option or something?
Context: the calibre eLibrary manager which is written in Python and Qt.
It currently displays as on the left. I'd like it to display as on the right
or even better, as the Open File dialog:
OpenFileDialog component opens the Windows dialog box for browsing and selecting files. To open and read the selected files, you can use the OpenFileDialog. OpenFile method, or create an instance of the System.
You can try this one:
QString QFileDialog::getExistingDirectory ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), Options options = ShowDirsOnly ) [static]
This one is used to choose a directory, and will popup a dialog like you show at last.
Demo:
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
"/home",
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks);
You can set the file mode in QFileDialog
to QFileDialog::Directory
see http://qt-project.org/doc/qt-5.0/qtwidgets/qfiledialog.html#FileMode-enum
Or You can use QFileDialog::setOption
with value QFileDialog::ShowDirsOnly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With