PDA

View Full Version : QFileDialog::getExistingDirectory locks up the application



gtSasha
28th December 2010, 05:26
Hello,

I am having a bizarre issue with QFileDialog::getExistingDirectory.

My application locks-up on this line:

QString path = QFileDialog::getExistingDirectory(this, tr("Select Folder"));

I stepped inside this function with a debugger and traced the execution all the way to qt_win_CID_get_existing_directory() function in qfiledialog_win.cpp

It locks up trying to show the dialog window on line 615:

hr = pfd->Show(parentWindow ? parentWindow->winId() : 0);

I am running a Qt app on Windows 7 64-bit system.

Any ideas what may be going on?

Thanks.

ChrisW67
28th December 2010, 05:36
What is "this" pointing to? Is it a QWidget of some sort?

gtSasha
28th December 2010, 07:20
Yes, 'this' is a QWidget.

I actually found this workaround using Qt dialog instead of the native dialog:


QFileDialog dlg(this);
dlg.setFileMode(QFileDialog::DirectoryOnly);
dlg.setOptions(QFileDialog::ShowDirsOnly);

int result = dlg.exec();

Works great. However, it would still be nice to know what is gong on with the native dialog.

Thanks.