Warning, /webapps/qmlonline/qml/examples/taphandler.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.12
0002 import QtQuick.Controls 2.5
0003 import QtQuick.Layouts 1.13
0004
0005 Rectangle {
0006 id: root
0007 color: "pink"
0008 anchors.fill: parent
0009 property var msgs: []
0010
0011 TapHandler {
0012 onTapped: newMsg("Left click!")
0013 }
0014 TapHandler {
0015 acceptedButtons: Qt.RightButton
0016 onTapped: newMsg("Right click!")
0017 }
0018
0019 function newMsg(msg) {
0020 console.log(msg)
0021 msgs.push(msg)
0022 // We need to force a *Changed* signal for normal js lists
0023 view.model = msgs
0024 }
0025
0026 ListView {
0027 id: view
0028 height: parent.height
0029 delegate: Text {
0030 text: index + ": " + modelData
0031 }
0032 }
0033 }