summaryrefslogtreecommitdiffstats
path: root/examples
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
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')
-rw-r--r--examples/declarative/dial/dial.pro9
-rw-r--r--examples/declarative/dial/dial.qrc10
-rw-r--r--examples/declarative/dial/main.cpp18
-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
12 files changed, 173 insertions, 136 deletions
diff --git a/examples/declarative/dial/dial.pro b/examples/declarative/dial/dial.pro
new file mode 100644
index 0000000..1d1f811
--- /dev/null
+++ b/examples/declarative/dial/dial.pro
@@ -0,0 +1,9 @@
+SOURCES = main.cpp
+RESOURCES = dial.qrc
+
+QT += script declarative
+
+target.path = $$[QT_INSTALL_EXAMPLES]/declarative/dial
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS dial.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/dial
+INSTALLS += target sources
diff --git a/examples/declarative/dial/dial.qrc b/examples/declarative/dial/dial.qrc
new file mode 100644
index 0000000..77354c0
--- /dev/null
+++ b/examples/declarative/dial/dial.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>DialLibrary/background.png</file>
+ <file>DialLibrary/overlay.png</file>
+ <file>DialLibrary/needle_shadow.png</file>
+ <file>DialLibrary/needle.png</file>
+ <file>DialLibrary/Dial.qml</file>
+ <file>dial.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/declarative/dial/main.cpp b/examples/declarative/dial/main.cpp
new file mode 100644
index 0000000..b65c9ff
--- /dev/null
+++ b/examples/declarative/dial/main.cpp
@@ -0,0 +1,18 @@
+#include <QApplication>
+#include <QUrl>
+#include <qmlview.h>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QmlView *canvas = new QmlView;
+ canvas->setUrl(QUrl("qrc:/dial.qml"));
+ canvas->execute();
+ canvas->resize(210,240);
+ canvas->show();
+
+ return app.exec();
+}
+
+
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]