views:

54

answers:

1

The "Browse For Folder" Windows dialog is very inconvenient because:

  • it has no Path box where I can paste the path I want (eg from Total Commander)
  • it always starts from the Desktop with everything closed

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 BrowserFileDialog

or even better, as the Open File dialog: OpenFileDialog

+7  A: 

You can set the file mode in QFileDialog to QFileDialog::Directory

see http://doc.trolltech.com/4.7/qfiledialog.html#FileMode-enum

Or You can use QFileDialog::setOption with value QFileDialog::ShowDirsOnly

NightCoder
The [code](http://bazaar.launchpad.net/~kovid/calibre/trunk/annotate/head%3A/src/calibre/gui2/__init__.py#L518) uses QFileDialog.getExistingDirectory(QFileDialog.Directory), and this displays the inconvenient "Browse For Folder" dialog.
Vladimir Alexiev
Should I use something like this?dialog = new QFileDialog();dialog.setOption(QFileDialog.ShowDirsOnly, true);dialog.getOpenFileName(QFileDialog.Directory);
Vladimir Alexiev
QFileDialog::DirectoryOnly is obsolete since Qt 4.5:Try using setOption()
NightCoder