Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.5.1
-
Windows
-
fc6d5ed18da29138494803baa11c0edc22ace7f4 (qtbase/5.7, 22.2.2016, 5.7)
Description
In case one calls QFileDialog::getSaveFileName() without any parameters, it shows an empty filter on Windows, which looks a bit odd. The issue isn't reproducing on Linux.
The attached code snippet can be used to reproduce the issue:
#include <QApplication> #include <QFileDialog> int main(int argc, char **argv) { QApplication app(argc, argv); QFileDialog::getSaveFileName(); return 0; }
If this is intended behaviour then it should be documented at least.
The patch here:
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1646,6 +1646,8 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog() const QStringList nameFilters = opts->nameFilters(); if (!nameFilters.isEmpty()) result->setNameFilters(nameFilters); + else + result->setNameFilters(QStringList() << QLatin1String("All Files (*.*)")); if (opts->isLabelExplicitlySet(QFileDialogOptions::FileName)) result->setLabelText(QFileDialogOptions::FileName, opts->labelText(QFileDialogOptions::FileName)); if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
can be used to workaround the problem. Doing it that way it shows all files in case no filters are set.
Attachments
For Gerrit Dashboard: QTBUG-50644 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
148193,4 | QFileDialogOptions: Expose default name filter setting. | 5.7 | qt/qtbase | Status: MERGED | +2 | 0 |