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

QFileDialog's native code never emits urlsSelected+urlSelected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Labels:
      None

      Description

      The Qt API docs for [QFileDialog| https://doc.qt.io/qt-5/qfiledialog.html tell for the signal QFileDialog::urlsSelected(const QList<QUrl> &urls):
      "When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) list of selected urls."

      So one would assume this signal and its fellow urlSelected(QUrl) are emitted without any platform specific conditions.

      Yet when QFileDialog does not get a QPlatformFileDialogHelper instance from any QPlatformTheme for QPlatformTheme::FileDialog, it will use its native implementation, which seems to not care for emitting the signals urlsSelected+urlSelected.

      Can be tested with attached sample program. I found no documented way to force the platformtheme to something using only Qt native code, best bet for me (in Plasma/Linux env) was forcing platform xcb and some dummy value for XDG_CURRENT_DESKTOP. Might need another way for you, if there is no official way.

      It shows how selecting a file and accepting the dialig does not trigger the signals with native QFileDialog implementation:

      > qmake
      > make
      > QT_QPA_PLATFORM=XCB  XDG_CURRENT_DESKTOP=UNKNOWN ./src # no ouput
      > QT_QPA_PLATFORM=XCB  XDG_CURRENT_DESKTOP=KDE ./src # expected output
      QFileDialog::urlsSelected emitted (QUrl("file:///home/user/some/file.txt"))
      QFileDialog::urlSelected emitted QUrl("file:///home/user/some/file.txt")
      

        Attachments

        1. main.cpp
          0.6 kB
        2. src.pro
          0.1 kB
        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:
            kossebau Friedrich W. H. Kossebau
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes