summaryrefslogtreecommitdiffstats
path: root/examples/declarative/mouseregion/mouse.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/mouseregion/mouse.qml')
-rw-r--r--examples/declarative/mouseregion/mouse.qml24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml
new file mode 100644
index 0000000..f0f22ac
--- /dev/null
+++ b/examples/declarative/mouseregion/mouse.qml
@@ -0,0 +1,24 @@
+<Rect color="white" width="200" height="200">
+ <Rect width="50" height="50" color="red">
+ <Text text="Click" anchors.centeredIn="{parent}"/>
+ <MouseRegion onPressed="print('press (x: ' + x + ' y: ' + y + ')')"
+ onReleased="print('release (x: ' + x + ' y: ' + y + ' isClick: ' + isClick + ' followsPressAndHold: ' + followsPressAndHold + ')')"
+ onClicked="print('click (x: ' + x + ' y: ' + y + ' followsPressAndHold: ' + followsPressAndHold + ')')"
+ onDoubleClicked="print('double click (x: ' + x + ' y: ' + y + ')')"
+ onPressAndHold="print('press and hold')"
+ onExitedWhilePressed="print('exiting while pressed')"
+ onReenteredWhilePressed="print('reentering while pressed')" anchors.fill="{parent}"/>
+ </Rect>
+ <Rect y="100" width="50" height="50" color="blue">
+ <Text text="Drag" anchors.centeredIn="{parent}"/>
+ <MouseRegion drag.target="{parent}"
+ drag.axis="x" drag.xmin="0" drag.xmax="150"
+ onPressed="print('press')"
+ onReleased="print('release (isClick: ' + isClick + ') (followsPressAndHold: ' + followsPressAndHold + ')')"
+ onClicked="print('click' + '(followsPressAndHold: ' + followsPressAndHold + ')')"
+ onDoubleClicked="print('double click')"
+ onPressAndHold="print('press and hold')"
+ onExitedWhilePressed="print('exiting while pressed')"
+ onReenteredWhilePressed="print('reentering while pressed')" anchors.fill="{parent}"/>
+ </Rect>
+</Rect>