summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative
diff options
context:
space:
mode:
authorJerome Pasion <jerome.pasion@nokia.com>2011-02-16 12:10:29 (GMT)
committerJerome Pasion <jerome.pasion@nokia.com>2011-02-16 12:10:29 (GMT)
commite2ae6a38ce2739cee52b7cae9198ca45e315c0cd (patch)
treebb9d89f462372a7beec77d803f7f42ff6ea10514 /doc/src/snippets/declarative
parent024e657219e86934fbbff94598744d59a234c204 (diff)
downloadQt-e2ae6a38ce2739cee52b7cae9198ca45e315c0cd.zip
Qt-e2ae6a38ce2739cee52b7cae9198ca45e315c0cd.tar.gz
Qt-e2ae6a38ce2739cee52b7cae9198ca45e315c0cd.tar.bz2
Added new snippet code.
Task-number: QTBUG-16071
Diffstat (limited to 'doc/src/snippets/declarative')
-rw-r--r--doc/src/snippets/declarative/mousearea/mousearea-snippet.qml55
1 files changed, 51 insertions, 4 deletions
diff --git a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
index 3c2e143..99cdc8b 100644
--- a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
+++ b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
@@ -41,13 +41,60 @@
//! [document]
import QtQuick 1.0
-Rectangle {
- width: 100; height: 100
+//! [parent begin]
+Rectangle {
+//! [parent begin]
+ width: 500; height: 500
color: "green"
- MouseArea {
+Column {
+//! [anchor fill]
+Rectangle {
+ id: button
+ width: 100; height: 100
+
+ MouseArea {
anchors.fill: parent
- onClicked: { parent.color = 'red' }
+ onClicked: console.log("button clicked")
+ }
+ MouseArea {
+ width:150; height: 75
+ onClicked: console.log("irregular area clicked")
+ }
+}
+//! [anchor fill]
+
+Rectangle {
+ id: button
+ width: 100; height: 100
+
+//! [enable handlers]
+ MouseArea {
+ hoverEnabled: true
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onEntered: console.log("mouse entered the area")
+ onExited: console.log("mouse left the area")
}
+//! [enable handlers]
+}
+
+Rectangle {
+ id: button
+ width: 100; height: 100
+
+//! [mouse handlers]
+ MouseArea {
+ anchors.fill: parent
+ onClicked: console.log("area clicked")
+ onDoubleClicked: console.log("area double clicked")
+ onEntered: console.log("mouse entered the area")
+ onExited: console.log("mouse left the area")
+ }
+//! [mouse handlers]
+}
+
+} //end of column
+//! [parent end]
}
+//! [parent end]
//! [document]