import QtQuick import QtQuick.Controls Window { width: 640 height: 480 visible: true title: qsTr("Hello World") id: window property int myTapCount: 0 Text { anchors.centerIn: parent text: "Click/Tap anywhere..." } Text { anchors.margins: 20 id: message anchors.bottom: parent.bottom anchors.left: parent.left text: "Nothing happened yet" } TapHandler { onTapped: { myTapCount++; message.text = "TapHandler tapped " + myTapCount; contextMenu.popup(); } } // If you replace the TapHandler with a MouseArea, then the stylus behaves the same as other pointer devices // MouseArea { // anchors.fill: parent // // onClicked: (mouse)=> { // myTapCount++; // message.text = "MouseArea clicked " + myTapCount // contextMenu.popup(); // } // } Rectangle { anchors.bottom: parent.bottom anchors.right: parent.right color: "lightBlue" width: 200 height: 100 MouseArea { anchors.fill: parent onPressed: (mouse)=> { message.text = "MouseArea pressed " } } } Menu { id: contextMenu MenuItem { text: "Cut"; onTriggered: message.text = "Triggered Cut" } MenuItem { text: "Copy"; onTriggered: message.text = "Triggered Copy" } MenuItem { text: "Paste"; onTriggered: message.text = "Triggered Paste" } } }