Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.4.0, 5.12, 5.15
-
None
-
OS X, native file dialog
-
-
5d9d3ff3269f92366b022e17485fa4dd98f5ba95 (qt/qtbase/5.15)
Description
Adding file filter to QFileDialog::getSaveFileName for user to be able to select i.e. "*.tar.gz" and than selecting format from pop up messes up/just appends .tar.gz to previously selected file name instead replacing extension or just add twice extension.
I.e. in Standard dialogs example add filters for *.tar and *.tar.gz:
void Dialog::setSaveFileName() { const QFileDialog::Options options = QFlag(fileDialogOptionsWidget->value()); QString selectedFilter; QString fileName = QFileDialog::getSaveFileName(this, tr("QFileDialog::getSaveFileName()"), saveFileNameLabel->text(), tr("All Files (*);;Text Files (*.txt);;Tar (*.tar);;Tar gzipped (*.tar.gz)"), &selectedFilter, options); if (!fileName.isEmpty()) saveFileNameLabel->setText(fileName); }
after showing save dialog, typing name test and switching popup to Tar gzipped (*.tar.gz) name becomes test.tar.gz.tar.gz, than switching to something other i.e. to Tar (*.tar) (there is also bug there it doesn't always change extension on first popup change) name becomes test.tar.gz.tar.gz.tar, and going furher switching popup to *.tar.gzip will change to name to test.tar.gz.tar.gz.tar.gz.tar.gz etc.
Even just selecting *.tar.gzip popup, fixing name to be test.tar.gz and clicking Save alert pops up (see attached pictures), and returned name if I select use both is test.tar.gz.tar.gz or selecting use .tar.gz returned name is test.tar.tar.gz
Only workaround I could think of is setting option QFileDialog::HideNameFilterDetails and filter to be "Tar gzipped (*)" and manually adding extension after dialog is closed
Attachments
Issue Links
- resulted in
-
QTBUG-109877 macOS: QFileDialog::getSaveFileName() truncates a compound extension
-
- Closed
-