summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-05-05 00:43:51 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-05-05 00:43:51 (GMT)
commit22959526d81bfd2195d389eddc88c626350b6925 (patch)
treeb3dd0df107e4e15ded2b30e40ae4d721428bf61c /examples
parent0e75846b831bbeb4794cc4e3d00cd3096726d35e (diff)
parentfab8fa152901cb84132f11b52f950c0dbb6d7a23 (diff)
downloadQt-22959526d81bfd2195d389eddc88c626350b6925.zip
Qt-22959526d81bfd2195d389eddc88c626350b6925.tar.gz
Qt-22959526d81bfd2195d389eddc88c626350b6925.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/contacts/main.cpp6
-rw-r--r--examples/declarative/dial/DialLibrary/Dial.qml8
-rw-r--r--examples/declarative/follow/pong.qml8
-rw-r--r--examples/declarative/listview/content/MediaButton.qml9
-rw-r--r--examples/declarative/listview/recipes.qml7
-rw-r--r--examples/declarative/minehunt/Description.qml4
-rw-r--r--examples/declarative/minehunt/Explosion.qml7
-rw-r--r--examples/declarative/minehunt/main.cpp4
-rw-r--r--examples/declarative/minehunt/minehunt.qml14
-rw-r--r--examples/declarative/scrollbar/ScrollBar.qml14
-rw-r--r--examples/declarative/slideswitch/Switch.qml7
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml10
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml1
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml2
-rw-r--r--examples/declarative/tutorials/helloworld/t1/tutorial1.qml (renamed from examples/declarative/tutorials/t1/tutorial1.qml)0
-rw-r--r--examples/declarative/tutorials/helloworld/t2/Cell.qml (renamed from examples/declarative/tutorials/t2/Cell.qml)6
-rw-r--r--examples/declarative/tutorials/helloworld/t2/tutorial2.qml27
-rw-r--r--examples/declarative/tutorials/helloworld/t3/Cell.qml (renamed from examples/declarative/tutorials/t3/Cell.qml)5
-rw-r--r--examples/declarative/tutorials/helloworld/t3/tutorial3.qml (renamed from examples/declarative/tutorials/t3/tutorial3.qml)39
-rw-r--r--examples/declarative/tutorials/t2/tutorial2.qml41
-rw-r--r--examples/declarative/velocity/Day.qml10
-rw-r--r--examples/declarative/webview/content/SpinSquare.qml11
22 files changed, 86 insertions, 154 deletions
diff --git a/examples/declarative/contacts/main.cpp b/examples/declarative/contacts/main.cpp
index 6bf9daf..bda6565 100644
--- a/examples/declarative/contacts/main.cpp
+++ b/examples/declarative/contacts/main.cpp
@@ -7,7 +7,7 @@
#include <QTime>
#include <QVBoxLayout>
-const char *defaultFileName("contacts.xml");
+const char *defaultFileName("contacts.qml");
class Contacts : public QWidget
{
@@ -43,8 +43,8 @@ Contacts::Contacts(const QString &fileName, int width, int height, QWidget *pare
QFile file(fileName);
file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setXml(xml, fileName);
+ QString qml = file.readAll();
+ canvas->setQml(qml, fileName);
canvas->execute();
}
diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml
index fe8528d..485188a 100644
--- a/examples/declarative/dial/DialLibrary/Dial.qml
+++ b/examples/declarative/dial/DialLibrary/Dial.qml
@@ -1,11 +1,9 @@
Item {
+ property real value : 0
+
width: 210
height: 210
- properties: Property {
- name: "value"
- type: "real"
- value: 0
- }
+
Image {
id: Background
source: "background.svg"
diff --git a/examples/declarative/follow/pong.qml b/examples/declarative/follow/pong.qml
index 32ee049..582b04c 100644
--- a/examples/declarative/follow/pong.qml
+++ b/examples/declarative/follow/pong.qml
@@ -5,14 +5,14 @@ Rect {
// Make a ball to bounce
Rect {
+ // Add a property for the target y coordinate
+ property var targetY : Page.height-10
+ property var direction : "right"
+
id: Ball
color: "#00ee00"
x: 20; width: 20; height: 20; z: 1
- // Add a property for the target y coordinate
- properties: Property { name: "targetY"; value: Page.height-10 }
- properties: Property { name: "direction"; value: "right" }
-
// Move the ball to the right and back to the left repeatedly
x: SequentialAnimation {
running: true; repeat: true
diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml
index bb2510a..cad36bd 100644
--- a/examples/declarative/listview/content/MediaButton.qml
+++ b/examples/declarative/listview/content/MediaButton.qml
@@ -1,11 +1,8 @@
Item {
+ property var text
+ signal clicked
+
id: Container
- signals: Signal {
- name: "clicked"
- }
- properties: Property {
- name: "text"
- }
Image {
id: Image
source: "pics/button.png"
diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml
index db9ef61..28785f1 100644
--- a/examples/declarative/listview/recipes.qml
+++ b/examples/declarative/listview/recipes.qml
@@ -16,11 +16,8 @@ Rect {
// We can bind multiple element's opacity to this one property,
// rather than having a "SetProperty" line for each element we
// want to fade.
- properties: Property {
- name: "detailsOpacity"
- value: 0
- type: "real"
- }
+ property real detailsOpacity : 0
+
// A simple rounded rectangle for the background
Rect {
id: background
diff --git a/examples/declarative/minehunt/Description.qml b/examples/declarative/minehunt/Description.qml
index f59c8f9..0241ae5 100644
--- a/examples/declarative/minehunt/Description.qml
+++ b/examples/declarative/minehunt/Description.qml
@@ -1,9 +1,7 @@
Item {
id: Page
height: MyText.height + 20
- properties: Property {
- name: "text"
- }
+ property var text
MouseRegion {
anchors.fill: parent
drag.target: Page
diff --git a/examples/declarative/minehunt/Explosion.qml b/examples/declarative/minehunt/Explosion.qml
index 8d868bc..2886559 100644
--- a/examples/declarative/minehunt/Explosion.qml
+++ b/examples/declarative/minehunt/Explosion.qml
@@ -1,9 +1,6 @@
Item {
- properties: Property {
- name: "explode"
- type: "Bool"
- value: false
- }
+ property bool explode : false
+
Particles {
width: 38
height: 21
diff --git a/examples/declarative/minehunt/main.cpp b/examples/declarative/minehunt/main.cpp
index 9db717b..7f10757 100644
--- a/examples/declarative/minehunt/main.cpp
+++ b/examples/declarative/minehunt/main.cpp
@@ -130,8 +130,8 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags
QFile file(fileName);
file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- canvas->setXml(xml, fileName);
+ QString qml = file.readAll();
+ canvas->setQml(qml, fileName);
QmlContext *ctxt = canvas->rootContext();
ctxt->activate();
diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml
index cde2612..58397b0 100644
--- a/examples/declarative/minehunt/minehunt.qml
+++ b/examples/declarative/minehunt/minehunt.qml
@@ -2,16 +2,10 @@ Item {
id: field
width: 370
height: 480
- properties: Property {
- name: "clickx"
- type: "Int"
- value: 0
- }
- properties: Property {
- name: "clicky"
- type: "Int"
- value: 0
- }
+
+ property int clickx : 0
+ property int clicky : 0
+
resources: [
Component {
id: tile
diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml
index e3ca0c2..929c72a 100644
--- a/examples/declarative/scrollbar/ScrollBar.qml
+++ b/examples/declarative/scrollbar/ScrollBar.qml
@@ -5,16 +5,10 @@ Item {
// height of the page, i.e. a pageSize of 0.5 means that you can see 50%
// of the height of the view.
// orientation can be either 'Vertical' or 'Horizontal'
- properties: Property {
- name: "position"
- }
- properties: Property {
- name: "pageSize"
- }
- properties: Property {
- name: "orientation"
- value: "Vertical"
- }
+ property var position
+ property var pageSize
+ property var orientation : "Vertical"
+
// A light, semi-transparent background
Rect {
id: Background
diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml
index 5862646..6777277 100644
--- a/examples/declarative/slideswitch/Switch.qml
+++ b/examples/declarative/slideswitch/Switch.qml
@@ -2,9 +2,9 @@ Item {
id: Switch
width: Groove.width
height: Groove.height
- properties: Property {
- name: "on"
- }
+
+ property var on
+
Script {
function toggle() {
@@ -14,7 +14,6 @@ Item {
Switch.state = "On";
}
function dorelease() {
- print(Knob.x);
if(Knob.x == 1) {
if(Switch.state == "Off")
return;
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
index 665c072..edaae72 100644
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
+++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
@@ -2,12 +2,10 @@ FocusRealm {
id: groupBox
width: Math.max(270, subItem.width+40)
height: Math.max(70, subItem.height+40)
- properties: Property {
- name: "contents"
- }
- properties: Property {
- name: "label"
- }
+
+ property var contents
+ property var label
+
Rect {
id: wrapper
x: 5
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml
index 33ac627..23560ce 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml
@@ -2,6 +2,7 @@ Item {
id: contactDetails
width: 230
height: layout.height
+
properties: Property {
name: "contactid"
value: ""
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
index 309ee5a..8d82e89 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
@@ -1,3 +1,4 @@
+//! [all]
Rect {
id: removeButton
width: 30
@@ -120,3 +121,4 @@ Rect {
}
]
}
+//! [all]
diff --git a/examples/declarative/tutorials/t1/tutorial1.qml b/examples/declarative/tutorials/helloworld/t1/tutorial1.qml
index ec29f4f..ec29f4f 100644
--- a/examples/declarative/tutorials/t1/tutorial1.qml
+++ b/examples/declarative/tutorials/helloworld/t1/tutorial1.qml
diff --git a/examples/declarative/tutorials/t2/Cell.qml b/examples/declarative/tutorials/helloworld/t2/Cell.qml
index bd5bbe7..0109251 100644
--- a/examples/declarative/tutorials/t2/Cell.qml
+++ b/examples/declarative/tutorials/helloworld/t2/Cell.qml
@@ -1,10 +1,10 @@
Item {
+ property var color
+
id: CellContainer
width: 40
height: 25
- properties: Property {
- name: "color"
- }
+
Rect {
anchors.fill: parent
color: CellContainer.color
diff --git a/examples/declarative/tutorials/helloworld/t2/tutorial2.qml b/examples/declarative/tutorials/helloworld/t2/tutorial2.qml
new file mode 100644
index 0000000..4630435
--- /dev/null
+++ b/examples/declarative/tutorials/helloworld/t2/tutorial2.qml
@@ -0,0 +1,27 @@
+Rect {
+ id: Page
+ width: 480
+ height: 200
+ color: "white"
+ Text {
+ id: HelloText
+ text: "Hello world!"
+ font.size: 24
+ font.bold: true
+ y: 30
+ anchors.horizontalCenter: Page.horizontalCenter
+ }
+ GridLayout {
+ 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/t3/Cell.qml b/examples/declarative/tutorials/helloworld/t3/Cell.qml
index bd5bbe7..e779406 100644
--- a/examples/declarative/tutorials/t3/Cell.qml
+++ b/examples/declarative/tutorials/helloworld/t3/Cell.qml
@@ -1,10 +1,9 @@
Item {
+ property var color
+
id: CellContainer
width: 40
height: 25
- properties: Property {
- name: "color"
- }
Rect {
anchors.fill: parent
color: CellContainer.color
diff --git a/examples/declarative/tutorials/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
index 8e2b697..3ca7a2f 100644
--- a/examples/declarative/tutorials/t3/tutorial3.qml
+++ b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
@@ -37,42 +37,23 @@ Rect {
duration: 500
easing: "easeOutBounce"
}
- ColorAnimation {
- duration: 500
- }
+ ColorAnimation { duration: 500 }
}
}
]
}
- MouseRegion {
- id: MouseRegion
- anchors.fill: HelloText
- }
+ MouseRegion { id: MouseRegion; anchors.fill: HelloText }
GridLayout {
id: ColorPicker
x: 0
anchors.bottom: Page.bottom
- width: 120
- height: 50
- columns: 3
- rows: 2
- Cell {
- color: "#ff0000"
- }
- Cell {
- color: "#00ff00"
- }
- Cell {
- color: "#0000ff"
- }
- Cell {
- color: "#ffff00"
- }
- Cell {
- color: "#00ffff"
- }
- Cell {
- color: "#ff00ff"
- }
+ 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/t2/tutorial2.qml b/examples/declarative/tutorials/t2/tutorial2.qml
deleted file mode 100644
index 08ea9eb..0000000
--- a/examples/declarative/tutorials/t2/tutorial2.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-Rect {
- id: Page
- width: 480
- height: 200
- color: "white"
- Text {
- id: HelloText
- text: "Hello world!"
- font.size: 24
- font.bold: true
- y: 30
- anchors.horizontalCenter: Page.horizontalCenter
- }
- GridLayout {
- id: ColorPicker
- x: 0
- anchors.bottom: Page.bottom
- width: 120
- height: 50
- columns: 3
- rows: 2
- Cell {
- color: "#ff0000"
- }
- Cell {
- color: "#00ff00"
- }
- Cell {
- color: "#0000ff"
- }
- Cell {
- color: "#ffff00"
- }
- Cell {
- color: "#00ffff"
- }
- Cell {
- color: "#ff00ff"
- }
- }
-}
diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml
index 7d26e88..c70a211 100644
--- a/examples/declarative/velocity/Day.qml
+++ b/examples/declarative/velocity/Day.qml
@@ -1,16 +1,12 @@
Rect {
+ property string day
+ property var stickies
+
width: 400
height: 500
radius: 7
pen.color: "black"
id: Page
- properties: Property {
- name: "day"
- type: "string"
- }
- properties: Property {
- name: "stickies"
- }
Image {
x: 10
y: 10
diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml
index 5c14506..5e4735e 100644
--- a/examples/declarative/webview/content/SpinSquare.qml
+++ b/examples/declarative/webview/content/SpinSquare.qml
@@ -1,13 +1,8 @@
Item {
+ properties var period : 250
+ properties var color : "black"
id: Root
- properties: Property {
- name: "period"
- value: 250
- }
- properties: Property {
- name: "color"
- value: "black"
- }
+
Item {
x: Root.width/2
y: Root.height/2