PDA

View Full Version : strange behavior with QFileDialog::getExistingDirectory



cemoktra
19th January 2012, 12:04
Hi,

i just was updating a Qt Application of our company and during testing i found some strange behaviour with QFileDialog::getExistingDirectory. This always worked correct but now i get an empty dialog containing only the title message and the buttons. The folder selection list has gone and i have no clue why. We are using Qt 4.7.4 and the application (as also Qt) is x64. I attached a screenshot of the dialog that opens and here the code. Normally i would say that you cannot make any mistakes using this function. As it has worked before and i did not changed anything in this class i'm wondering whats the problem.



if (qsFolder.isEmpty())
qsFolder = pValue->getDefault().toString();
qsFolder = QDir::fromNativeSeparators(qsFolder);
qsFolder = QFileDialog::getExistingDirectory(this, "Select capture folder", qsFolder);
qsFolder = QDir::toNativeSeparators(qsFolder);


Any help is appreciated.
Bye


SOLVED:
Well i found the reason in the msdn:

If COM is initialized using CoInitializeEx with the COINIT_MULTITHREADED flag, SHBrowseForFolder fails if the calling application uses the BIF_USENEWUI or BIF_NEWDIALOGSTYLE flag in the BROWSEINFO structure.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762115(v=vs.85).aspx

Sorry for bothering you
Thx

EH
2nd May 2013, 13:20
I have exactly the same problem. How ca I fix it woithout changuing the qt sourcecode?