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

[Reg 5.15->6.x][Android] MessageDialog's standard buttons do not accept/reject the dialog

XMLWordPrintable

    • Android, iOS/tvOS/watchOS
    • b00798df9 (dev), 18fc3862d (6.6), ec8564963 (tqtc/lts-6.5), 8dd687836 (dev)
    • 2023wk44FOQtforAndroid, 2023wk46FOQtforAndroid, 2023wk48FOQtforAndroid

      Code

      import QtQuick
      import QtQuick.Dialogs
      
      Window {
          width: 640
          height: 480
          visible: true
      
          MessageDialog {
              id: dlg
              title: "Error"
              text: "You can't close me"
              buttons: MessageDialog.Ok | MessageDialog.Cancel
              onAccepted: console.log("Yea")
              onRejected: console.log("Nay")
          }
      
          Component.onCompleted: dlg.open()
      }
      

       

      Expected outcomes when clicking a button (Windows/Linux)

      • The debug output prints "Yea" or "Nay", depending on which button was clicked
      • The dialog disappears

       

      Actual outcomes when clicking a button (Android)

      • Nothing happens

       

      Partial workaround

      If we use import Qt.labs.platform instead of import QtQuick.Dialogs then the dialog does disappear. However, the onAccepted/onRejected handlers still don't seem to be run.

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

            bartlomiejmoskal Bartlomiej Moskal
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: