View Full Version : QFileDialog disable Dir Path

15th April 2008, 19:21

How to disable drop down option in the comboBox in the QFileDialog so user can view only current directory path. I have tried using static such as getSaveFileName etc. But I am not able to either dsiable directory path combobox or drop down paths. I want to restrict user to view only given path.

QString path = qApp->applicationDirPath ();
QFileDialog* fd = new QFileDialog( path );

fd->setPreviewMode( QFileDialog::Contents );

Any ideas or hints will be helpful.

15th April 2008, 20:48
You'll need to do some hacking. You have to check Qt's sources to find out what the object name of the combobox is. Then use qFindChildren() (or whatever it is called in Qt3) on the dialog to query for the pointer to the object with a given name. Then you'll be able to hide or disable the widget.

15th April 2008, 20:57
Thanks Wyosta ..That's exactly I did and solved my problem. I used QObject::queryList to find the objectName and type.