summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-08 03:59:19 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-08 03:59:19 (GMT)
commit5ab2f873e9eb91071bad3cc04c38f84e4b1cbdda (patch)
tree9356ce9fda60256a04f070f4524a32ecd88e7b32 /examples/declarative/tutorials
parent3215a23a399d881afafcf3cb9524124d452c669b (diff)
parent08a1c212752bd1c1eeda1706c9531ac502441f35 (diff)
downloadQt-5ab2f873e9eb91071bad3cc04c38f84e4b1cbdda.zip
Qt-5ab2f873e9eb91071bad3cc04c38f84e4b1cbdda.tar.gz
Qt-5ab2f873e9eb91071bad3cc04c38f84e4b1cbdda.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui-scriptopt
Diffstat (limited to 'examples/declarative/tutorials')
-rw-r--r--examples/declarative/tutorials/helloworld/Cell.qml32
-rw-r--r--examples/declarative/tutorials/helloworld/t1/tutorial1.qml16
-rw-r--r--examples/declarative/tutorials/helloworld/t2/Cell.qml18
-rw-r--r--examples/declarative/tutorials/helloworld/t2/tutorial2.qml29
-rw-r--r--examples/declarative/tutorials/helloworld/t3/Cell.qml17
-rw-r--r--examples/declarative/tutorials/helloworld/t3/tutorial3.qml56
-rw-r--r--examples/declarative/tutorials/helloworld/tutorial1.qml22
-rw-r--r--examples/declarative/tutorials/helloworld/tutorial2.qml31
-rw-r--r--examples/declarative/tutorials/helloworld/tutorial3.qml51
9 files changed, 136 insertions, 136 deletions
diff --git a/examples/declarative/tutorials/helloworld/Cell.qml b/examples/declarative/tutorials/helloworld/Cell.qml
new file mode 100644
index 0000000..ab6e565
--- /dev/null
+++ b/examples/declarative/tutorials/helloworld/Cell.qml
@@ -0,0 +1,32 @@
+//![0]
+import Qt 4.6
+
+//![1]
+Item {
+ id: container
+//![4]
+ property alias color: rectangle.color
+//![4]
+//![5]
+ signal clicked(string color)
+//![5]
+
+ width: 40; height: 25
+//![1]
+
+//![2]
+ Rectangle {
+ id: rectangle
+ border.color: "white"
+ anchors.fill: parent
+ }
+//![2]
+
+//![3]
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: container.clicked(container.color)
+ }
+//![3]
+}
+//![0]
diff --git a/examples/declarative/tutorials/helloworld/t1/tutorial1.qml b/examples/declarative/tutorials/helloworld/t1/tutorial1.qml
deleted file mode 100644
index e2c6650..0000000
--- a/examples/declarative/tutorials/helloworld/t1/tutorial1.qml
+++ /dev/null
@@ -1,16 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: page
- width: 480
- height: 200
- color: "LightGrey"
- Text {
- id: helloText
- text: "Hello world!"
- font.pointSize: 24
- font.bold: true
- y: 30
- anchors.horizontalCenter: page.horizontalCenter
- }
-}
diff --git a/examples/declarative/tutorials/helloworld/t2/Cell.qml b/examples/declarative/tutorials/helloworld/t2/Cell.qml
deleted file mode 100644
index bfd835d..0000000
--- a/examples/declarative/tutorials/helloworld/t2/Cell.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-import Qt 4.6
-
-Item {
- property var color
-
- id: cellContainer
- width: 40
- height: 25
-
- Rectangle {
- anchors.fill: parent
- color: cellContainer.color
- }
- MouseRegion {
- anchors.fill: parent
- onClicked: { helloText.color = cellContainer.color }
- }
-}
diff --git a/examples/declarative/tutorials/helloworld/t2/tutorial2.qml b/examples/declarative/tutorials/helloworld/t2/tutorial2.qml
deleted file mode 100644
index aee9032..0000000
--- a/examples/declarative/tutorials/helloworld/t2/tutorial2.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: page
- width: 480
- height: 200
- color: "LightGrey"
- Text {
- id: helloText
- text: "Hello world!"
- font.pointSize: 24
- font.bold: true
- y: 30
- anchors.horizontalCenter: page.horizontalCenter
- }
- Grid {
- id: colorPicker
- x: 0
- anchors.bottom: page.bottom
- width: 120; height: 50
- rows: 2; columns: 3
- Cell { color: "#ff0000" }
- Cell { color: "#00ff00" }
- Cell { color: "#0000ff" }
- Cell { color: "#ffff00" }
- Cell { color: "#00ffff" }
- Cell { color: "#ff00ff" }
- }
-}
diff --git a/examples/declarative/tutorials/helloworld/t3/Cell.qml b/examples/declarative/tutorials/helloworld/t3/Cell.qml
deleted file mode 100644
index 6feb7a9..0000000
--- a/examples/declarative/tutorials/helloworld/t3/Cell.qml
+++ /dev/null
@@ -1,17 +0,0 @@
-import Qt 4.6
-
-Item {
- property var color
-
- id: cellContainer
- width: 40
- height: 25
- Rectangle {
- anchors.fill: parent
- color: cellContainer.color
- }
- MouseRegion {
- anchors.fill: parent
- onClicked: { helloText.color = cellContainer.color }
- }
-}
diff --git a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
deleted file mode 100644
index b80065d..0000000
--- a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: page
- width: 480
- height: 200
- color: "LightGrey"
- Text {
- id: helloText
- text: "Hello world!"
- font.pointSize: 24
- font.bold: true
- y: 30
- anchors.horizontalCenter: page.horizontalCenter
- states: [
- State {
- name: "down"
- when: mouseRegion.pressed == true
- PropertyChanges {
- target: helloText
- y: 160
- color: "red"
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "down"
- reversible: true
- ParallelAnimation {
- NumberAnimation {
- properties: "y"
- duration: 500
- easing: "easeOutBounce"
- }
- ColorAnimation { property: "color"; duration: 500 }
- }
- }
- ]
- }
- MouseRegion { id: mouseRegion; anchors.fill: helloText }
- Grid {
- id: colorPicker
- x: 0
- anchors.bottom: page.bottom
- width: 120; height: 50
- rows: 2; columns: 3
- Cell { color: "#ff0000" }
- Cell { color: "#00ff00" }
- Cell { color: "#0000ff" }
- Cell { color: "#ffff00" }
- Cell { color: "#00ffff" }
- Cell { color: "#ff00ff" }
- }
-}
diff --git a/examples/declarative/tutorials/helloworld/tutorial1.qml b/examples/declarative/tutorials/helloworld/tutorial1.qml
new file mode 100644
index 0000000..93d3c34
--- /dev/null
+++ b/examples/declarative/tutorials/helloworld/tutorial1.qml
@@ -0,0 +1,22 @@
+//![0]
+//![3]
+import Qt 4.6
+//![3]
+
+//![1]
+Rectangle {
+ id: page
+ width: 500; height: 200
+ color: "lightgray"
+//![1]
+
+//![2]
+ Text {
+ id: helloText
+ text: "Hello world!"
+ font.pointSize: 24; font.bold: true
+ y: 30; anchors.horizontalCenter: page.horizontalCenter
+ }
+//![2]
+}
+//![0]
diff --git a/examples/declarative/tutorials/helloworld/tutorial2.qml b/examples/declarative/tutorials/helloworld/tutorial2.qml
new file mode 100644
index 0000000..99889d7
--- /dev/null
+++ b/examples/declarative/tutorials/helloworld/tutorial2.qml
@@ -0,0 +1,31 @@
+//![0]
+import Qt 4.6
+
+Rectangle {
+ id: page
+ width: 500; height: 200
+ color: "lightgray"
+
+ Text {
+ id: helloText
+ text: "Hello world!"
+ font.pointSize: 24; font.bold: true
+ y: 30; anchors.horizontalCenter: page.horizontalCenter
+ }
+
+ Grid {
+ id: colorPicker
+ anchors.bottom: page.bottom
+ rows: 2; columns: 3; spacing: 3
+
+//![1]
+ Cell { color: "red"; onClicked: helloText.color = color }
+//![1]
+ Cell { color: "green"; onClicked: helloText.color = color }
+ Cell { color: "blue"; onClicked: helloText.color = color }
+ Cell { color: "yellow"; onClicked: helloText.color = color }
+ Cell { color: "steelblue"; onClicked: helloText.color = color }
+ Cell { color: "black"; onClicked: helloText.color = color }
+ }
+}
+//![0]
diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml
new file mode 100644
index 0000000..d641eba
--- /dev/null
+++ b/examples/declarative/tutorials/helloworld/tutorial3.qml
@@ -0,0 +1,51 @@
+//![0]
+import Qt 4.6
+
+Rectangle {
+ id: page
+ width: 500; height: 200
+ color: "lightgray"
+
+ Text {
+ id: helloText
+ text: "Hello world!"
+ font.pointSize: 24; font.bold: true
+ y: 30; anchors.horizontalCenter: page.horizontalCenter
+ transformOrigin: "Center"
+
+//![1]
+ MouseRegion { id: mouseRegion; anchors.fill: parent }
+//![1]
+
+//![2]
+ states: State {
+ name: "down"; when: mouseRegion.pressed == true
+ PropertyChanges { target: helloText; y: 160; rotation: 180; color: "red" }
+ }
+//![2]
+
+//![3]
+ transitions: Transition {
+ from: ""; to: "down"; reversible: true
+ ParallelAnimation {
+ NumberAnimation { properties: "y,rotation"; duration: 500; easing: "easeInOutQuad" }
+ ColorAnimation { property: "color"; duration: 500 }
+ }
+ }
+//![3]
+ }
+
+ Grid {
+ id: colorPicker
+ anchors.bottom: page.bottom
+ rows: 2; columns: 3; spacing: 3
+
+ Cell { color: "red"; onClicked: helloText.color = color }
+ Cell { color: "green"; onClicked: helloText.color = color }
+ Cell { color: "blue"; onClicked: helloText.color = color }
+ Cell { color: "yellow"; onClicked: helloText.color = color }
+ Cell { color: "steelblue"; onClicked: helloText.color = color }
+ Cell { color: "black"; onClicked: helloText.color = color }
+ }
+}
+//![0]