Details
-
Bug
-
Resolution: Cannot Reproduce
-
Not Evaluated
-
None
-
5.4.1
-
Windows
Description
The following code demonstrates the behaviour on Windows, on Linux everything is fine.
When entering a filename with extension, everything is fine, when entering one without extension while having the "all files" filter selected, selectedFiles contains the entered filename with the first extension of the first filter (apart from the "all files" filter) appended. So in case of the example code, a .jpeg is appended.
This might be related to QTBUG-44641 but does not happen on Linux.
#include <QApplication> #include <QDebug> #include <QFileDialog> int main(int argc, char* argv[]) { QApplication app(argc, argv); QFileDialog fd; fd.setAcceptMode(QFileDialog::AcceptSave); fd.setMimeTypeFilters(QStringList() << "application/octet-stream"<< "image/jpeg" << "text/plain"); if(fd.exec() == QDialog::Accepted) qDebug() << fd.selectedFiles() << fd.selectedNameFilter(); return app.exec(); }
Attachments
Issue Links
- relates to
-
QTBUG-44641 QFileDialog::getSaveFileName changes file extension even if the selected filter matches the extension
- Reported