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

Not possible to use ContextMenu on event-consuming types like Pane

    XMLWordPrintable

Details

    • 70c61b12e (dev), 019feea9b (6.9)

    Description

      It should be possible to use ContextMenu on a Pane:

      import QtQuick
      import QtQuick.Controls.Basic
      
      ApplicationWindow {
          id: window
          width: 600
          height: 400
          visible: true
      
          Pane {
              anchors.fill: parent
              anchors.margins: 20
      
              ContextMenu.menu: Menu {
                  MenuItem {
                      text: qsTr("Eat tomato")
                  }
                  MenuItem {
                      text: qsTr("Throw tomato")
                  }
                  MenuItem {
                      text: qsTr("Squash tomato")
                  }
              }
          }
      }
      

      This worked until https://codereview.qt-project.org/c/qt/qtbase/+/555514/11..12/src/gui/kernel/qwindow.cpp, which stopped the context menu event from being unconditionally sent. Since Pane accepts mouse events, it never gets sent the ContextMenu event.

      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
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There is 1 open Gerrit change