summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-05-04 01:13:24 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-05-04 01:14:11 (GMT)
commit56dcdada14f1a499da5a458bdada2127e73dc630 (patch)
tree8abc1ebc66ee494461ec3eda7fd29b468340ac04 /doc/src/snippets
parent536d0f141a13474122f99daf98bf6b54e635b474 (diff)
downloadQt-56dcdada14f1a499da5a458bdada2127e73dc630.zip
Qt-56dcdada14f1a499da5a458bdada2127e73dc630.tar.gz
Qt-56dcdada14f1a499da5a458bdada2127e73dc630.tar.bz2
Doc improvements
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/declarative/dynamicObjects.qml30
-rw-r--r--doc/src/snippets/declarative/flickableScrollbar.qml26
2 files changed, 56 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/dynamicObjects.qml b/doc/src/snippets/declarative/dynamicObjects.qml
new file mode 100644
index 0000000..dd55d78
--- /dev/null
+++ b/doc/src/snippets/declarative/dynamicObjects.qml
@@ -0,0 +1,30 @@
+import Qt 4.7
+
+//![0]
+Rectangle {
+ id: rootItem
+ width: 300
+ height: 300
+
+ Component {
+ id: rectComponent
+
+ Rectangle {
+ id: rect
+ width: 40; height: 40;
+ color: "red"
+
+ NumberAnimation on opacity { from: 1; to: 0; duration: 1000 }
+
+ Component.onCompleted: rect.destroy(1000);
+ }
+ }
+
+ function createRectangle() {
+ var object = rectComponent.createObject();
+ object.parent = rootItem;
+ }
+
+ Component.onCompleted: createRectangle()
+}
+//![0]
diff --git a/doc/src/snippets/declarative/flickableScrollbar.qml b/doc/src/snippets/declarative/flickableScrollbar.qml
new file mode 100644
index 0000000..147751a
--- /dev/null
+++ b/doc/src/snippets/declarative/flickableScrollbar.qml
@@ -0,0 +1,26 @@
+import Qt 4.7
+
+//![0]
+Rectangle {
+ width: 200; height: 200
+
+ Flickable {
+ id: flickable
+//![0]
+ anchors.fill: parent
+ contentWidth: image.width; contentHeight: image.height
+
+ Image { id: image; source: "pics/qt.png" }
+//![1]
+ }
+
+ Rectangle {
+ id: scrollbar
+ anchors.right: flickable.right
+ y: flickable.visibleArea.yPosition * flickable.height
+ width: 10
+ height: flickable.visibleArea.heightRatio * flickable.height
+ color: "black"
+ }
+}
+//![1]