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

Setting menu position breaks Esc order

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.2
    • Quick: Controls 2
    • None
    • Linux/X11

    Description

      Given the following code

      import QtQuick
      import QtQuick.Controls
      
      ApplicationWindow {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Button {
              text: "Open popup"
              onClicked: dialog.open()
              Dialog {
                  id: dialog
                  modal: true
                  parent: Overlay.overlay
                  anchors.centerIn: parent
                  Row {
                      Button {
                          id: checkbox
                          checkable: true
                          text: checked ? "menu.popup()" : "menu.open()"
                      }
                      TextArea {
                          text: "Open menu"
                          Menu {
                              id: menu
                              Action {
                                  text: "Action 1"
                              }
                              Action {
                                  text: "Action 2"
                              }
                          }
                          onPressed: event => {
                              if (checkbox.checked)
                                  menu.popup(event.x, event.y);
                              else {
                                  menu.open();
                              }
                          }
                      }
                  }
              }
          }
      }
      
      

      When the menu is opened using menu.open() pressing Esc twice first closes the menu and then the dialog.

      When using menu.popup() pressing Esc twice first closes the dialog and then the menu.

      Using

      menu.x = event.x;
      menu.y = event.y;
      menu.open();
      

      hase the same effect as using menu.popup().

      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
            bterrier Benjamin Terrier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes