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

QML lost the ability to show top level dialogs?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.2.2
    • Quick: Controls 2
    • None

    Description

      Hi,

      I want to show a dialog (like the good old QMessageBox but with custom content).

      I've learned - the very hard way - that i should not rely on labs components. Those have a tendency to be utterly broken or don't live in a future version at all. So i'm staying away from anything that is in the labs. This means the QML component MessageDialog is out. Besides the fact that it only allows custom text, not more then that.

      What remains are 3 different Dialog implementations in QML..

      https://doc.qt.io/qt-6/qml-qt-labs-platform-dialog.html (it's out because it's in labs)

      https://doc.qt.io/qt-6/qml-qtquick-controls2-dialog.html (potential candidate)

      https://doc.qt.io/qt-6/qml-qtquick-dialogs-dialog.html (potential candidate 2)

      First up the "potential candidate". I don't know what or why but apparently this type of dialog (it's in the Controls 2 set) is not a dialog at all. It doesn't open in a top level popup window. It's not styled according to the theme you're using. It's downright conflicting when compared to QDialog (which is a top level window). So this dialog is useless in my case.

      Thankfully we still have one more option.. The Potential candidate 2, which is in the Dialogs set. Sounds promising. Till you try to use it. It cannot be used - at all - as a dialog! You can only use it's derivatives (FileDialog and FontDialog). There is 0 documentation on how to derive that dialog to make use of it. Therefore this dialog isn't usable.

      Now we're out of options in the Qt components world. I wanted a dialog that is styled in whatever the controls are styled but that seems to be too much to ask.

      I don't see any way to work around this when i want to keep the components style. The only remotely usable option i see is to go the full "do it yourself" route with a Window component and build on top of that. That's very far from ideal and will look out of place.

      Could Qt fix this situation and provide a dialog that is akin to the dialog in the labs set (Qt.labs.platform) but with the themed look of the Controls 2 package?

      Attachments

        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
              markg85 Mark
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes