From a5336a0577b715edf49bef3794c6b1a8fa225a73 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 23 Apr 2012 14:39:48 +1000 Subject: More example docs MouseArea, Threading and TouchInteraction Change-Id: I9ca812d20a6c87d68ef91066ae0a4b9bc8829478 Reviewed-by: Michael Brasser --- examples/quick/mousearea/mousearea.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'examples/quick/mousearea') 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] } } -- cgit v1.2.3