Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] Qt5 - QFileDialog shows only directories
Banshee last edited by
Since I use Qt5 (and not Qt4.8), my QFileDialog shows only directories and no files anymore.
path = dialog.selectedFiles().isEmpty() ? QString() : dialog.selectedFiles();
In addition, the QFileDialog doesn't use the stylesheet of its parent, but the native Windows-Style. It seems like Qt5 now uses the native "select directory"-dialog for the options above.
But there is no change in the "documentation":https://qt-project.org/doc/qt-5.0/qtwidgets/qfiledialog.html#FileMode-enum, so how can I get that behaviour to be as it was in Qt4?
I use Qt5.2.0-msvc2010-opengl on Win7.
Thank you all :)
[EDIT: Ok, I found the problem:
Since Qt5, you need setOption(QFileDialog::DontUseNativeDialog) to disable the native dialog.
I think it is a bit confusing that setFileMode(QFileDialog::Directory) doesn't show files on WIndows even if its mentioned to do it in the documentation, but well.]
AFAIK, Qt 4 also used native dialogs by default.
Then indeed, there's no styling propagated since the dialog comes directly from the OS (in your case windows) So are you saying the between Qt 4 and Qt 5 the native dialog doesn't do the same things ?