diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2012-04-23 14:39:48 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-26 04:53:08 +0200 |
commit | a5336a0577b715edf49bef3794c6b1a8fa225a73 (patch) | |
tree | a7cc3ad59d7af572e1582aa9f8eb9546697a7e6c /examples/quick/mousearea | |
parent | 5e62f313588dc81c7284c4eb451cb9ebe7f3c994 (diff) |
More example docs
MouseArea, Threading and TouchInteraction
Change-Id: I9ca812d20a6c87d68ef91066ae0a4b9bc8829478
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'examples/quick/mousearea')
-rw-r--r-- | examples/quick/mousearea/mousearea.qml | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/quick/mousearea/mousearea.qml b/examples/quick/mousearea/mousearea.qml index df26e05a3c..cdc2364b1f 100644 --- a/examples/quick/mousearea/mousearea.qml +++ b/examples/quick/mousearea/mousearea.qml @@ -47,6 +47,17 @@ import QtQuick 2.0 \image qml-mousearea-example.png This example shows you how to respond to clicks and drags with a MouseArea. + + When you click inside the red square, the Text element will list several properties + of that click which are available to QML. + + Signals are emitted by the MouseArea when clicks or other discrete operations occur within it + \snippet examples/quick/mousearea/mousearea.qml clicks + + The MouseArea can also be used to drag elements around. By setting the parameters of the drag property, + the target item will be dragged around if the user starts to drag within the MouseArea. + \snippet examples/quick/mousearea/mousearea.qml drag + */ Rectangle { @@ -141,9 +152,11 @@ Rectangle { posInfo.text = '' } + //! [clicks] onPressAndHold: btn.text = 'Press and hold' onClicked: btn.text = 'Clicked (wasHeld=' + mouse.wasHeld + ')' onDoubleClicked: btn.text = 'Double clicked' + //! [clicks] } } @@ -157,12 +170,14 @@ Rectangle { MouseArea { anchors.fill: parent + //! [drag] drag.target: blueSquare drag.axis: Drag.XandYAxis drag.minimumX: 0 drag.maximumX: box.width - parent.width drag.minimumY: 0 drag.maximumY: box.height - parent.width + //! [drag] } } |