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

QFileDialog::getOpenFileContent not honoring nameFilter

    XMLWordPrintable

Details

    • 709ca8212e (qt/qtbase/dev) 709ca8212e (qt/tqtc-qtbase/dev) ff37a211da (qt/qtbase/6.3) ff37a211da (qt/tqtc-qtbase/6.3) 69676296b2 (qt/qtbase/6.4) 69676296b2 (qt/tqtc-qtbase/6.4) ff5c351cab (qt/tqtc-qtbase/6.2), b47e0cef8 (tqtc/lts-5.15)

    Description

      https://code.woboq.org/qt6/qtbase/src/widgets/dialogs/qfiledialog.cpp.html#_ZN11QFileDialog18getOpenFileContentERK7QStringRKSt8functionIFvS2_RK10QByteArrayEE

      The first argument of QFileDialog::getOpenFileContent is nameFilter – in the Q_OS_WASM block, this is unused (with a comment about Qt and Web name filter string formats), but in the else block which is to be used on non-WASM platforms, it is being passed to a newly created QFileDialog via `selectNameFilter(nameFilter)` where no filters have yet to be set.

      The fix is simple, which should simply be to swap in `setNameFilter(nameFilter);` instead at line 2337.

      (Bonus points if nameFilter can be honored in the WASM section of the function!)

      Attachments

        1. QTBUG-104948.patch
          0.6 kB
          Kevin Keating

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              cdvonbargen Chris Von Bargen
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: