summaryrefslogtreecommitdiffstats
path: root/examples/declarative/mouseregion
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-04-30 04:54:49 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-04-30 04:54:49 (GMT)
commitf2fb6b63c6e5572d02245c64da652f13174588b9 (patch)
treeb12510b317cf9f01ecf01f9d4f082864207fc1b8 /examples/declarative/mouseregion
parent0204346fb91eaf73893b651438980cb9ca5f1f51 (diff)
downloadQt-f2fb6b63c6e5572d02245c64da652f13174588b9.zip
Qt-f2fb6b63c6e5572d02245c64da652f13174588b9.tar.gz
Qt-f2fb6b63c6e5572d02245c64da652f13174588b9.tar.bz2
Convert all examples and demos from XML format
Diffstat (limited to 'examples/declarative/mouseregion')
-rw-r--r--examples/declarative/mouseregion/mouse.qml72
1 files changed, 48 insertions, 24 deletions
diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml
index 7aaf51a..6d10425 100644
--- a/examples/declarative/mouseregion/mouse.qml
+++ b/examples/declarative/mouseregion/mouse.qml
@@ -1,24 +1,48 @@
-<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: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers &amp; Qt.ShiftModifier ? 'true' : 'false') + ')')"
- 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}"/>
- </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: ' + 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')"
- onReenteredWhilePressed="print('reentering while pressed')" anchors.fill="{parent}"/>
- </Rect>
-</Rect>
+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: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') }
+ 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
+ }
+ }
+ 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: ' + 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') }
+ onReenteredWhilePressed: { print('reentering while pressed') }
+ anchors.fill: parent
+ }
+ }
+}