Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.15.2, 6.2.0
-
None
Description
When I open a QFileDialog for saving the file and select the filter to be ALL Files, ideally I would have expected no extension to be appended to the saved files, however, the extension of the first filter in the list is appended to the file while saving it. I have attached a sample code to reproduce the same. The selected file in the code has .png appended to it when "All Files" is selected as a filter
#include <QApplication> #include <QFileDialog> #include <QString> int main(int argc, char *argv[]) { QApplication a(argc, argv); QFileDialog fd; QStringList filter = {"Image files{png} (*.png)","Text files (*.txt)","Any files (*)"}; fd.setNameFilters(filter); fd.setOptions(QFileDialog::HideNameFilterDetails); fd.setAcceptMode(QFileDialog::AcceptSave); if (fd.exec()) { auto selectedFilter = fd.selectedNameFilter(); auto namefilters = fd.nameFilters(); auto fileSel = fd.selectedFiles()[0]; } return a.exec(); }