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

Warning on nameFilters change in QML FileDialog

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.10.1, 5.12.3
    • Fix Version/s: None
    • Component/s: Quick: Dialogs
    • Labels:
      None
    • Platform/s:
      Windows

      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

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

          Activity

            People

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

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes