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

Add parent argument to QFileDialog::getOpenFileContent

    XMLWordPrintable

Details

    • 7c5cf8cae (dev), 253957b94 (6.7)

    Description

      The #else path (that is, the non-WASM fallback) of QFileDialog::getOpenFileContent creates a QDialog without a parent:
      https://github.com/qt/qtbase/blob/ba1eec62a864428e4486b1e15f41ff06fc8f60d4/src/widgets/dialogs/qfiledialog.cpp#L2326-L2342

      We are running into the issue where, if we make this call in a non-WASM context inside another application, a QDialog created from getOpenFileContent will lack parenting to the main window embedding our widget, thus preventing interaction.

      One proposal would be to add an additional `QWidget *parent = nullptr` parameter to QFileDialog::getOpenFileContent which would be used only in the fallback mechanism creating a QDialog.

      Fundamentally, there is a question of whether QFileDialog::getOpenFileContent should be used in non-WASM contexts where other windows are present and you'd expect window modality. Or if QFileDialog::getOpenFileContent should work as similarly as possible between WASM builds and non-WASM builds, forcing application modality in all cases.

      Attachments

        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:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change