Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-109877

macOS: QFileDialog::getSaveFileName() truncates a compound extension

    XMLWordPrintable

Details

    • macOS
    • fd817c28a (dev), b814f73fb (6.7), cab9a6166 (6.6), d651cdb98 (dev), 5dabb905e (6.7), e47a811dc (tqtc/lts-6.5), 7a2aff560 (tqtc/lts-6.2)

    Description

      Code

      #include <QApplication>
      #include <QFileDialog>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          qDebug() << QFileDialog::getSaveFileName(nullptr, "Caption", "MyFile", "Archive (*.tar.gz)");
      }
      

       

      Expected results (Windows/Linux)

      • The default filename in the dialog is "MyFile.tar.gz"
      • If you manually change the filename in the dialog to "abc", the debug output shows "abc.tar.gz"

      Actual results (macOS)

      • The default filename in the dialog is "MyFile.gz"
      • If you manually change the filename in the dialog to "abc", the debug output shows "abc.gz"

       

      Original Report

      Using QFileDialog::getSaveFileName() with a file filter of:

      "All NASA/FUN3D files (*.b8.ugrid *.mapbc);;NASA/FUN3D b8.ugrid files (*.b8.ugrid);;NASA/FUN3D mapbc files (*.mapbc);;All files (*)"

      If the user enters just a basename (no extension) in the dialog box, QFileDialog::getSaveFileName() returns basename.ugrid instead of the expected basename.b8.ugrid (the first filter's extension). The .b8 is getting culled by the dialog.

      Linux and winOS both return basename.b8.ugrid as expected.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-109877
          # Subject Branch Project Status CR V

          Activity

            People

              vestbo Tor Arne Vestbø
              dbgarlisch David Garlisch
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: