PDA

View Full Version : QFileDialog disable Dir Path



user_mail07
15th April 2008, 18:21
Guys,

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 );
fd->exec();

Any ideas or hints will be helpful.

wysota
15th April 2008, 19: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.

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