diff options
author | Martin Smith <msmith@trolltech.com> | 2010-04-15 10:23:57 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2010-04-15 10:23:57 (GMT) |
commit | e4282111378ce67a1ae9c235efbd89b327f1bb91 (patch) | |
tree | 175fca0d6b40940f8bcba61e4b6563145f5dde70 /examples/declarative/mousearea | |
parent | 114cb018c088570ff0640eeb0d57594905ff9fcf (diff) | |
parent | b1c8bdc899cd276fcb90ad424b128bd7d8a21e21 (diff) | |
download | Qt-e4282111378ce67a1ae9c235efbd89b327f1bb91.zip Qt-e4282111378ce67a1ae9c235efbd89b327f1bb91.tar.gz Qt-e4282111378ce67a1ae9c235efbd89b327f1bb91.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'examples/declarative/mousearea')
-rw-r--r-- | examples/declarative/mousearea/mouse.qml | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/examples/declarative/mousearea/mouse.qml b/examples/declarative/mousearea/mouse.qml index efbfb53..67302a8 100644 --- a/examples/declarative/mousearea/mouse.qml +++ b/examples/declarative/mousearea/mouse.qml @@ -1,40 +1,47 @@ import Qt 4.7 Rectangle { - color: "white" width: 200; height: 200 + Rectangle { width: 50; height: 50 color: "red" + Text { text: "Click"; anchors.centerIn: parent } + MouseArea { + anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: { console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') } - onReleased: { console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') } - onClicked: { console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') } - onDoubleClicked: { console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') } - onPressAndHold: { console.log('press and hold') } - onEntered: { console.log('entered ' + pressed) } - onExited: { console.log('exited ' + pressed) } - anchors.fill: parent + + onPressed: console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') + onReleased: console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') + onClicked: console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') + onDoubleClicked: console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') + onPressAndHold: console.log('press and hold') + onEntered: console.log('entered ' + pressed) + onExited: console.log('exited ' + pressed) } } + Rectangle { y: 100; width: 50; height: 50 color: "blue" + Text { text: "Drag"; anchors.centerIn: parent } + MouseArea { + anchors.fill: parent drag.target: parent drag.axis: "XAxis" drag.minimumX: 0 drag.maximumX: 150 - onPressed: { console.log('press') } - onReleased: { console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') } - onClicked: { console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')') } - onDoubleClicked: { console.log('double click') } - onPressAndHold: { console.log('press and hold') } - anchors.fill: parent + + onPressed: console.log('press') + onReleased: console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') + onClicked: console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')') + onDoubleClicked: console.log('double click') + onPressAndHold: console.log('press and hold') } } } |