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

Warning on nameFilters change in QML FileDialog

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.4.3, 6.5.0, 6.6.0
    • 5.10.1, 5.12.3
    • Quick: Dialogs
    • None
    • Windows
    • de704b633 (dev), c662fb0be (6.5), b75ab7662 (6.4)

    Description

      Sample code:

        Button {
          id: filtersButton
          property bool flag: true
          anchors.centerIn: parent
          text: flag ? "PNG (*.png)" : "JPEG (*.jpg)"
          onClicked: flag = !flag
        }
      
        Button {
          id: openButton
          anchors.horizontalCenter: filtersButton.horizontalCenter
          anchors.top: filtersButton.bottom
          anchors.topMargin: 16
          text: "Open"
          onClicked: fileDialog.visible = true
        }
      
        FileDialog {
          id: fileDialog
          nameFilters: filtersButton.text
        }
      

      Steps to reproduce:
      1. Click openButton to open file dialog.
      QWindowsNativeFileDialogBase::setNameFilters will be called, which will set m_nameFilters.
      2. Close file dialog.
      3. Click filtersButton to swap filters.
      QWindowsNativeFileDialogBase::selectNameFilter will be called. It will try to find index of a new filter in m_nameFilters. But it fails because m_nameFilters still contains old list of filters, since it is updated only on the dialog open. This produce two similar messages in console:

      QWindowsNativeFileDialogBase::selectNameFilter: Invalid parameter 'JPEG (*.jpg)' not found in 'PNG (*.png)'.
      QWindowsNativeFileDialogBase::selectNameFilter: Invalid parameter 'JPEG (*.jpg)' not found in 'PNG (*.png)'.
      

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              bobdmv Dmitry Bobylev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes