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

QFileDialog::HideNameFilterDetails breaks default filter

    XMLWordPrintable

Details

    • 0de487a10f3a54c46f30042b96c321f982e01a90

    Description

      Steps to reproduce / test case
      When using QFileDialog::getSaveFileName, if you pass QFileDialog::HideNameFilterDetails as the flag the filter extensions are properly omitted but the default filter is not auto selected when the save dialog is shown. For example, say we used QFileDialog::getSaveFileName like so:

      QString filename = defaultFilename;

      filename = QFileDialog::getSaveFileName(this, tr("Foo"), filename,
      filtersStr, &chosenFilterString,
      QFileDialog::HideNameFilterDetails);

      In this situation chosenFilterString is a QString that was automatically set to something like "PNG (*.png)". That filter is one of many (but not the first) filters in the filtersStr, separated by ;;. When the Save As dialog is shown the 1st filter, not the proper default filter, is shown. If you omit the QFileDialog::HideNameFilterDetails flag the correct default filter is shown. This may also effect other QFileDialog functions like getting a file to open etc.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            menard Alexis Menard (closed Nokia identity) (Inactive)
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes