summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/declarative/drag.qml16
-rw-r--r--doc/src/snippets/declarative/mouseregion.qml23
-rw-r--r--doc/src/snippets/declarative/repeater.qml12
3 files changed, 51 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/drag.qml b/doc/src/snippets/declarative/drag.qml
new file mode 100644
index 0000000..3a573ad
--- /dev/null
+++ b/doc/src/snippets/declarative/drag.qml
@@ -0,0 +1,16 @@
+//! [0]
+Rect {
+ id: blurtest; width: 600; height: 200; color: "white"
+ Image {
+ id: pic; source: "qtlogo-64.png"; anchors.verticalCenter: parent.verticalCenter
+ opacity: (600.0-pic.x) / 600;
+ MouseRegion {
+ anchors.fill: parent
+ drag.target: pic
+ drag.axis: "x"
+ drag.xmin: 0
+ drag.xmax: blurtest.width-pic.width
+ }
+ }
+}
+//! [0]
diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/mouseregion.qml
new file mode 100644
index 0000000..5c1afe6
--- /dev/null
+++ b/doc/src/snippets/declarative/mouseregion.qml
@@ -0,0 +1,23 @@
+Rect { width: 200; height: 100
+HorizontalLayout {
+//! [0]
+Rect { width: 100; height: 100; color: "green"
+ MouseRegion { anchors.fill: parent; onClicked: { parent.color = 'red' } }
+}
+//! [0]
+//! [1]
+Rect {
+ width: 100; height: 100; color: "green"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: {
+ if (mouse.button == Qt.RightButton)
+ parent.color = 'blue';
+ else
+ parent.color = 'red';
+ }
+ }
+}
+//! [1]
+}
+}
diff --git a/doc/src/snippets/declarative/repeater.qml b/doc/src/snippets/declarative/repeater.qml
new file mode 100644
index 0000000..c8f9f18
--- /dev/null
+++ b/doc/src/snippets/declarative/repeater.qml
@@ -0,0 +1,12 @@
+//! [0]
+Rect { width: 220; height: 20; color: "white"
+ Component { id: Dot
+ Rect { width: 20; height: 20; radius: 10; color: "green" }
+ }
+ HorizontalLayout {
+ Rect { width: 10; height: 20; color: "red" }
+ Repeater { component: Dot; dataSource: 10 }
+ Rect { width: 10; height: 20; color: "blue" }
+ }
+}
+//! [0]