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

MessageDialog accepted handler isn’t called for Ok button

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.6
    • 6.5.5, 6.6.2
    • Quick: Dialogs
    • None
    • Linux/Wayland
    • 641e5cb4b (6.6), e9838d715 (tqtc/lts-6.5)

    Description

      In Qt 6.6.2, the MessageDialog accepted signal isn’t emitted for the Ok button:

      MessageDialog {
          text: "Really?"
          buttons: MessageDialog.Ok | MessageDialog.Cancel
          onAccepted: console.log("Accepted")
          onRejected: console.log("Rejected")
          onButtonClicked: (button, role) => {
              console.log("Button", button, "Role", role);
          }
      }
      

      Using Universal style and the QML dialog implementation.

      Clicking the Ok button prints

      qml: Button 1024 Role 0
      qml: Rejected
      

      Button 1024 is OkButton and 0 is AcceptedRole, so the correct button is detected but the dialog isn’t accepted.

      It feels like the close() call that was added causes the dialog to be rejected? https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=b00798df9d842570524550b6780a1debc4fe5387

      This worked in Qt 6.6.1

      Attachments

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

        Activity

          People

            hurlevent Oliver Eftevaag
            broulik Kai Uwe Broulik
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes