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

QML: MessageDialog closes on click outside

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.3
    • Quick: Dialogs
    • None
    • Windows

    Description

      I'm trying to show an QML MessageDialog with Qt 6.4.3. This dialog should be closed with the provided button.

      Here a minimalistic example:

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Dialogs

      ApplicationWindow  {
          id: window

          width: 800
          height: 600

          visible: true

          title: qsTr("Hello World")

          Component.onCompleted: dialog.open()

          MessageDialog{
              id: dialog

              modality: Qt.ApplicationModal

              title: "Test Dialog"
              text: "My Text"

              buttons: MessageDialog.Ok
       }

      }

      PROBLEM: The dialog is dismissed, if the user clickes outside the dialog. I would expect the dialog to stay visible until the user pressed the OK button.

      A workaround is to listen to the onRejected signal. But this is not working, if you have a dialog with a CANCEL button.

      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
            bandler Jürgen Lutz
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes