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

Can't open platform context menu from MouseArea's onPressed handler on Ubuntu 16.04

    XMLWordPrintable

Details

    Description

      import QtQuick 2.8
      import QtQuick.Window 2.2
      import Qt.labs.platform 1.0
      
      Window {
          id: window
          width: 400
          height: 400
          visible: true
      
          MouseArea {
              anchors.fill: parent
              acceptedButtons: Qt.RightButton
              // Doesn't work
              onPressed: contextMenu.open()
              // Works
      //        onClicked: contextMenu.open()
          }
      
          Menu {
              id: contextMenu
      
              MenuItem {
                  text: qsTr("Copy")
              }
              MenuItem {
                  text: qsTr("Cut")
              }
              MenuItem {
                  text: qsTr("Paste")
              }
          }
      }
      

      Full error message:

      (untitled:26215): GLib-GObject-CRITICAL **: g_object_set_data: assertion 'G_IS_OBJECT (object)' failed
      

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes