summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-04-27 07:39:47 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-04-27 07:39:47 (GMT)
commitd782ceee4de31bc4a11cd6cdeacc881bd1c118d8 (patch)
tree59622d424b34ca6d5195fb2ddcc4f4dc393abbd1 /examples
parentc33403a2e6a567a1e9bae9c0384a70dcae7d9961 (diff)
downloadQt-d782ceee4de31bc4a11cd6cdeacc881bd1c118d8.zip
Qt-d782ceee4de31bc4a11cd6cdeacc881bd1c118d8.tar.gz
Qt-d782ceee4de31bc4a11cd6cdeacc881bd1c118d8.tar.bz2
Make MouseRegion signals pass a mouse event as their parameter.
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/connections/connections.qml6
-rw-r--r--examples/declarative/mouseregion/mouse.qml12
2 files changed, 9 insertions, 9 deletions
diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml
index 3146338..45c0e99 100644
--- a/examples/declarative/connections/connections.qml
+++ b/examples/declarative/connections/connections.qml
@@ -1,9 +1,9 @@
<Rect id="rect" color="blue" width="40" height="30">
<Rect id="dot" color="red" width="3" height="3" x="{rect.width/2}" y="{rect.height/2}"/>
<MouseRegion id="mr" anchors.fill="{rect}"/>
- <Connection sender="{mr}" signal="clicked(x,y)">
+ <Connection sender="{mr}" signal="clicked(mouse)">
color="green";
- dot.x = x-1;
- dot.y = y-1;
+ dot.x = mouse.x-1;
+ dot.y = mouse.y-1;
</Connection>
</Rect>
diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml
index f0f22ac..9581da2 100644
--- a/examples/declarative/mouseregion/mouse.qml
+++ b/examples/declarative/mouseregion/mouse.qml
@@ -1,10 +1,10 @@
<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 + ')')"
+ <MouseRegion onPressed="print('press (x: ' + mouse.x + ' y: ' + mouse.y + ')')"
+ onReleased="print('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')')"
+ onClicked="print('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')')"
+ onDoubleClicked="print('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')')"
onPressAndHold="print('press and hold')"
onExitedWhilePressed="print('exiting while pressed')"
onReenteredWhilePressed="print('reentering while pressed')" anchors.fill="{parent}"/>
@@ -14,8 +14,8 @@
<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 + ')')"
+ onReleased="print('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')')"
+ onClicked="print('click' + '(wasHeld: ' + mouse.wasHeld + ')')"
onDoubleClicked="print('double click')"
onPressAndHold="print('press and hold')"
onExitedWhilePressed="print('exiting while pressed')"