PDA

View Full Version : How to disable a button in a QFileDialog?



TeresaML
18th June 2010, 10:02
Hello,

I have a FileDialog:
QString fileName = QFileDialog::getExistingDirectory(this,tr("OPEN DIRECTORY"));

It's created with three buttons by default (Create a new directory, open and cancel). I would like to eliminate the button "Create a new directory" from the FileDialog. How could I do this? Thanks!

rajeevpodar
18th June 2010, 15:38
You have to write the custom one in this case.

For reference even style sheet is not applied even if you set it on the main application. :(

squidge
18th June 2010, 19:41
Are you using the native dialog ? If so, you will need platform specific code to do that (Call SHBrowseForFolder with BIF_NONEWFOLDERBUTTON flag). If not, then you can subclass.

Note that BIF_NONEWFOLDERBUTTON is only available on Comdlg V6.0+ (WinXP+)