summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-13 02:24:13 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-13 02:24:13 (GMT)
commit3e94b3a77affeef80544e48949e018ced4e0d96e (patch)
tree621251f4fd85ced80d80e15f8d120e90bc095585 /doc/src/snippets
parente9a0067ef4b272f1893522959dc15561970590ea (diff)
parentff0020481398e7c109973949260a42711c4cdcdc (diff)
downloadQt-3e94b3a77affeef80544e48949e018ced4e0d96e.zip
Qt-3e94b3a77affeef80544e48949e018ced4e0d96e.tar.gz
Qt-3e94b3a77affeef80544e48949e018ced4e0d96e.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (147 commits) doc fixes Don't test XmlListModel examples on platforms without QtXmlPatterns More error output for QML_IMPORT_TRACE=1 Fix declarative examples autotest, avoid using native separators Doc: update Rectangle smooth painting screenshot. Add some TextInput properties and methods Remove GraphicsObjectContainer from the documentation. import Qt 4.6 -> import Qt 4.7 Move documentation code to snippet. Test fix. Fix test Fix test on QWS. Fix PathView crash. Make bindings dump more useful Improve font value type documentation. coding conventions Doc fixes Warning Read Maemo orientation at startup Exclude gestures from examples autotest ...
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/declarative/border-image.qml32
-rw-r--r--doc/src/snippets/declarative/codingconventions/dotproperties.qml28
-rw-r--r--doc/src/snippets/declarative/codingconventions/javascript-imports.qml7
-rw-r--r--doc/src/snippets/declarative/codingconventions/javascript.qml33
-rw-r--r--doc/src/snippets/declarative/codingconventions/lists.qml22
-rw-r--r--doc/src/snippets/declarative/codingconventions/myscript.js9
-rw-r--r--doc/src/snippets/declarative/codingconventions/photo.qml37
-rw-r--r--doc/src/snippets/declarative/comments.qml2
-rw-r--r--doc/src/snippets/declarative/drag.qml2
-rw-r--r--doc/src/snippets/declarative/flipable.qml2
-rw-r--r--doc/src/snippets/declarative/gradient.qml2
-rw-r--r--doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml2
-rw-r--r--doc/src/snippets/declarative/gridview/gridview.qml2
-rw-r--r--doc/src/snippets/declarative/listview/dummydata/ContactModel.qml2
-rw-r--r--doc/src/snippets/declarative/listview/highlight.qml4
-rw-r--r--doc/src/snippets/declarative/listview/listview.qml2
-rw-r--r--doc/src/snippets/declarative/mouseregion.qml2
-rw-r--r--doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml2
-rw-r--r--doc/src/snippets/declarative/pathview/pathattributes.qml2
-rw-r--r--doc/src/snippets/declarative/pathview/pathview.qml2
-rw-r--r--doc/src/snippets/declarative/repeater-index.qml2
-rw-r--r--doc/src/snippets/declarative/repeater.qml2
-rw-r--r--doc/src/snippets/declarative/rotation.qml2
-rw-r--r--doc/src/snippets/declarative/workerscript.qml24
24 files changed, 192 insertions, 34 deletions
diff --git a/doc/src/snippets/declarative/border-image.qml b/doc/src/snippets/declarative/border-image.qml
index c4215cd..9c4247e 100644
--- a/doc/src/snippets/declarative/border-image.qml
+++ b/doc/src/snippets/declarative/border-image.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
id: page
@@ -9,23 +9,21 @@ Rectangle {
anchors.centerIn: parent
spacing: 50
//! [0]
- BorderImage {
- width: 180; height: 180
- border.left: 30; border.top: 30
- border.right: 30; border.bottom: 30
- horizontalTileMode: BorderImage.Stretch
- verticalTileMode: BorderImage.Stretch
- source: "content/colors.png"
- }
+BorderImage {
+ width: 180; height: 180
+ border { left: 30; top: 30; right: 30; bottom: 30 }
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ source: "content/colors.png"
+}
- BorderImage {
- width: 180; height: 180
- border.left: 30; border.top: 30
- border.right: 30; border.bottom: 30
- horizontalTileMode: BorderImage.Round
- verticalTileMode: BorderImage.Round
- source: "content/colors.png"
- }
+BorderImage {
+ width: 180; height: 180
+ border { left: 30; top: 30; right: 30; bottom: 30 }
+ horizontalTileMode: BorderImage.Round
+ verticalTileMode: BorderImage.Round
+ source: "content/colors.png"
+}
//! [0]
}
}
diff --git a/doc/src/snippets/declarative/codingconventions/dotproperties.qml b/doc/src/snippets/declarative/codingconventions/dotproperties.qml
new file mode 100644
index 0000000..942b0b1
--- /dev/null
+++ b/doc/src/snippets/declarative/codingconventions/dotproperties.qml
@@ -0,0 +1,28 @@
+import Qt 4.7
+
+Item {
+
+//! [0]
+Rectangle {
+ anchors.left: parent.left; anchors.top: parent.top; anchors.right: parent.right; anchors.leftMargin: 20
+}
+
+Text {
+ text: "hello"
+ font.bold: true; font.italic: true; font.pixelSize: 20; font.capitalization: Font.AllUppercase
+}
+
+//! [0]
+
+//! [1]
+Rectangle {
+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: 20 }
+}
+
+Text {
+ text: "hello"
+ font { bold: true; italic: true; pixelSize: 20; capitalization: Font.AllUppercase }
+}
+//! [1]
+
+}
diff --git a/doc/src/snippets/declarative/codingconventions/javascript-imports.qml b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml
new file mode 100644
index 0000000..417366c
--- /dev/null
+++ b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+
+//![0]
+import "myscript.js" as Script
+
+Rectangle { color: "blue"; width: Script.calculateWidth(parent) }
+//![0]
diff --git a/doc/src/snippets/declarative/codingconventions/javascript.qml b/doc/src/snippets/declarative/codingconventions/javascript.qml
new file mode 100644
index 0000000..64b5a40
--- /dev/null
+++ b/doc/src/snippets/declarative/codingconventions/javascript.qml
@@ -0,0 +1,33 @@
+import Qt 4.7
+
+Rectangle {
+
+//![0]
+Rectangle { color: "blue"; width: parent.width / 3 }
+//![0]
+
+//![1]
+Rectangle {
+ color: "blue"
+ width: {
+ var w = parent.width / 3
+ console.debug(w)
+ return w
+ }
+}
+//![1]
+
+//![2]
+function calculateWidth(object)
+{
+ var w = object.width / 3
+ // ...
+ // more javascript code
+ // ...
+ console.debug(w)
+ return w
+}
+
+Rectangle { color: "blue"; width: calculateWidth(parent) }
+//![2]
+}
diff --git a/doc/src/snippets/declarative/codingconventions/lists.qml b/doc/src/snippets/declarative/codingconventions/lists.qml
new file mode 100644
index 0000000..63e8100
--- /dev/null
+++ b/doc/src/snippets/declarative/codingconventions/lists.qml
@@ -0,0 +1,22 @@
+import Qt 4.7
+
+Item {
+ Item {
+//! [0]
+states: [
+ State {
+ name: "open"
+ PropertyChanges { target: container; width: 200 }
+ }
+]
+//! [0]
+ }
+ Item {
+//! [1]
+states: State {
+ name: "open"
+ PropertyChanges { target: container; width: 200 }
+}
+//! [1]
+ }
+}
diff --git a/doc/src/snippets/declarative/codingconventions/myscript.js b/doc/src/snippets/declarative/codingconventions/myscript.js
new file mode 100644
index 0000000..cfa6462
--- /dev/null
+++ b/doc/src/snippets/declarative/codingconventions/myscript.js
@@ -0,0 +1,9 @@
+function calculateWidth(parent)
+{
+ var w = parent.width / 3
+ // ...
+ // more javascript code
+ // ...
+ console.debug(w)
+ return w
+}
diff --git a/doc/src/snippets/declarative/codingconventions/photo.qml b/doc/src/snippets/declarative/codingconventions/photo.qml
new file mode 100644
index 0000000..c28c2c9
--- /dev/null
+++ b/doc/src/snippets/declarative/codingconventions/photo.qml
@@ -0,0 +1,37 @@
+import Qt 4.7
+
+//! [0]
+Rectangle {
+ id: photo // id on the first line makes it easy to find an object
+
+ property bool thumbnail: false // property declarations
+ property alias image: photoImage.source
+
+ signal clicked // signal declarations
+
+ function doSomething(x) { // javascript functions
+ return x + photoImage.width
+ }
+
+ x: 20; y: 20; width: 200; height: 150 // object properties
+ color: "gray" // try to group related properties together
+
+ Rectangle { // child objects
+ id: border
+ anchors.centerIn: parent; color: "white"
+
+ Image { id: photoImage; anchors.centerIn: parent }
+ }
+
+ states: State { // states
+ name: "selected"
+ PropertyChanges { target: border; color: "red" }
+ }
+
+ transitions: Transition { // transitions
+ from: ""; to: "selected"
+ ColorAnimation { target: border; duration: 200 }
+ }
+}
+//! [0]
+
diff --git a/doc/src/snippets/declarative/comments.qml b/doc/src/snippets/declarative/comments.qml
index 806be29..ab1bbc9 100644
--- a/doc/src/snippets/declarative/comments.qml
+++ b/doc/src/snippets/declarative/comments.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Text {
text: "Hello world!" //a basic greeting
diff --git a/doc/src/snippets/declarative/drag.qml b/doc/src/snippets/declarative/drag.qml
index 8e5b599..9465efb 100644
--- a/doc/src/snippets/declarative/drag.qml
+++ b/doc/src/snippets/declarative/drag.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
//! [0]
Rectangle {
diff --git a/doc/src/snippets/declarative/flipable.qml b/doc/src/snippets/declarative/flipable.qml
index c837ebc..ae74345 100644
--- a/doc/src/snippets/declarative/flipable.qml
+++ b/doc/src/snippets/declarative/flipable.qml
@@ -1,5 +1,5 @@
//! [0]
-import Qt 4.6
+import Qt 4.7
Flipable {
id: flipable
diff --git a/doc/src/snippets/declarative/gradient.qml b/doc/src/snippets/declarative/gradient.qml
index 281360e..168398d 100644
--- a/doc/src/snippets/declarative/gradient.qml
+++ b/doc/src/snippets/declarative/gradient.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 100; height: 100
diff --git a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
index 3cf9ba7..90f139d 100644
--- a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
+++ b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
ListModel {
id: contactModel
diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml
index 1a2021c..1d3df97 100644
--- a/doc/src/snippets/declarative/gridview/gridview.qml
+++ b/doc/src/snippets/declarative/gridview/gridview.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
//! [3]
Rectangle {
diff --git a/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml
index 6832308..20687cf 100644
--- a/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml
+++ b/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
ListModel {
id: contactModel
diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml
index 6a9d215..794b3f2 100644
--- a/doc/src/snippets/declarative/listview/highlight.qml
+++ b/doc/src/snippets/declarative/listview/highlight.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 180; height: 200; color: "white"
@@ -45,7 +45,7 @@ Rectangle {
width: 180; height: 40
color: "lightsteelblue"; radius: 5
SpringFollow on y {
- source: list.currentItem.y
+ to: list.currentItem.y
spring: 3
damping: 0.2
}
diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml
index be0f3ad..61bf126 100644
--- a/doc/src/snippets/declarative/listview/listview.qml
+++ b/doc/src/snippets/declarative/listview/listview.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
//! [3]
Rectangle {
diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/mouseregion.qml
index fc6c8f0..a464069 100644
--- a/doc/src/snippets/declarative/mouseregion.qml
+++ b/doc/src/snippets/declarative/mouseregion.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle { width: 200; height: 100
Row {
diff --git a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml b/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml
index 1334cf4..4004076 100644
--- a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml
+++ b/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
ListModel {
id: menuModel
diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml
index 99d0de2..ba860c2 100644
--- a/doc/src/snippets/declarative/pathview/pathattributes.qml
+++ b/doc/src/snippets/declarative/pathview/pathattributes.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 240; height: 200; color: 'white'
diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml
index e316578..3686398 100644
--- a/doc/src/snippets/declarative/pathview/pathview.qml
+++ b/doc/src/snippets/declarative/pathview/pathview.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 240; height: 200; color: 'white'
diff --git a/doc/src/snippets/declarative/repeater-index.qml b/doc/src/snippets/declarative/repeater-index.qml
index 9063967..709eaf2 100644
--- a/doc/src/snippets/declarative/repeater-index.qml
+++ b/doc/src/snippets/declarative/repeater-index.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 50; height: childrenRect.height; color: "white"
diff --git a/doc/src/snippets/declarative/repeater.qml b/doc/src/snippets/declarative/repeater.qml
index f8ac856..02a8208 100644
--- a/doc/src/snippets/declarative/repeater.qml
+++ b/doc/src/snippets/declarative/repeater.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 220; height: 20; color: "white"
diff --git a/doc/src/snippets/declarative/rotation.qml b/doc/src/snippets/declarative/rotation.qml
index 4a67dcb..f2fd78c 100644
--- a/doc/src/snippets/declarative/rotation.qml
+++ b/doc/src/snippets/declarative/rotation.qml
@@ -1,4 +1,4 @@
-import Qt 4.6
+import Qt 4.7
Rectangle {
width: 360; height: 80
diff --git a/doc/src/snippets/declarative/workerscript.qml b/doc/src/snippets/declarative/workerscript.qml
new file mode 100644
index 0000000..838e7e5
--- /dev/null
+++ b/doc/src/snippets/declarative/workerscript.qml
@@ -0,0 +1,24 @@
+//![0]
+import Qt 4.7
+
+Rectangle {
+ width: 300; height: 300
+
+ Text {
+ id: myText
+ text: 'Click anywhere'
+ }
+
+ WorkerScript {
+ id: myWorker
+ source: "script.js"
+
+ onMessage: myText.text = messageObject.reply
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myWorker.sendMessage({ 'x': mouse.x, 'y': mouse.y })
+ }
+}
+//![0]