summaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative')
-rw-r--r--examples/declarative/border-image/animated.qml17
-rw-r--r--examples/declarative/border-image/borders.qml4
-rw-r--r--examples/declarative/border-image/content/MyBorderImage.qml (renamed from examples/declarative/border-image/MyBorderImage.qml)0
-rw-r--r--examples/declarative/border-image/content/bw.png (renamed from examples/declarative/border-image/bw.png)bin1357 -> 1357 bytes
-rw-r--r--examples/declarative/border-image/content/colors-round.sci (renamed from examples/declarative/border-image/colors-round.sci)0
-rw-r--r--examples/declarative/border-image/content/colors-stretch.sci (renamed from examples/declarative/border-image/colors-stretch.sci)0
-rw-r--r--examples/declarative/border-image/content/colors.png (renamed from examples/declarative/border-image/colors.png)bin1655 -> 1655 bytes
-rw-r--r--examples/declarative/border-image/example.qml31
-rw-r--r--examples/declarative/clock/Clock.qml80
-rw-r--r--examples/declarative/clock/display.qml7
-rw-r--r--examples/declarative/clock/hour.pngbin391 -> 0 bytes
-rw-r--r--examples/declarative/clock/minute.pngbin445 -> 0 bytes
-rw-r--r--examples/declarative/clock/second.pngbin345 -> 0 bytes
-rw-r--r--examples/declarative/clocks/clocks.qml15
-rw-r--r--examples/declarative/clocks/content/Clock.qml77
-rw-r--r--examples/declarative/clocks/content/background.png (renamed from examples/declarative/clock/background.png)bin46895 -> 46895 bytes
-rwxr-xr-xexamples/declarative/clocks/content/center.pngbin0 -> 765 bytes
-rwxr-xr-xexamples/declarative/clocks/content/clock.pngbin0 -> 21780 bytes
-rwxr-xr-xexamples/declarative/clocks/content/hour.pngbin0 -> 625 bytes
-rwxr-xr-xexamples/declarative/clocks/content/minute.pngbin0 -> 625 bytes
-rwxr-xr-xexamples/declarative/clocks/content/second.pngbin0 -> 303 bytes
-rw-r--r--examples/declarative/connections/connections.qml9
-rw-r--r--examples/declarative/connections/content/Button.qml (renamed from examples/declarative/connections/Button.qml)0
-rw-r--r--examples/declarative/connections/content/bg1.jpg (renamed from examples/declarative/connections/bg1.jpg)bin23771 -> 23771 bytes
-rw-r--r--examples/declarative/connections/content/rotate-left.png (renamed from examples/declarative/connections/rotate-left.png)bin3061 -> 3061 bytes
-rw-r--r--examples/declarative/connections/content/rotate-right.png (renamed from examples/declarative/connections/rotate-right.png)bin3115 -> 3115 bytes
-rw-r--r--examples/declarative/dynamic/dynamic.qml13
-rw-r--r--examples/declarative/dynamic/qml/Button.qml (renamed from examples/declarative/dynamic/Button.qml)2
-rw-r--r--examples/declarative/dynamic/qml/GenericItem.qml (renamed from examples/declarative/dynamic/GenericItem.qml)0
-rw-r--r--examples/declarative/dynamic/qml/PaletteItem.qml (renamed from examples/declarative/dynamic/PaletteItem.qml)0
-rw-r--r--examples/declarative/dynamic/qml/PerspectiveItem.qml (renamed from examples/declarative/dynamic/PerspectiveItem.qml)0
-rw-r--r--examples/declarative/dynamic/qml/Sun.qml (renamed from examples/declarative/dynamic/Sun.qml)4
-rw-r--r--examples/declarative/dynamic/qml/itemCreation.js (renamed from examples/declarative/dynamic/itemCreation.js)1
33 files changed, 119 insertions, 141 deletions
diff --git a/examples/declarative/border-image/animated.qml b/examples/declarative/border-image/animated.qml
index aaaf495..29c02b3 100644
--- a/examples/declarative/border-image/animated.qml
+++ b/examples/declarative/border-image/animated.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import "content"
Rectangle {
id: page
@@ -8,47 +9,47 @@ Rectangle {
MyBorderImage {
x: 20; y: 20; minWidth: 120; maxWidth: 240
minHeight: 120; maxHeight: 240
- source: "colors.png"; margin: 30
+ source: "content/colors.png"; margin: 30
}
MyBorderImage {
x: 270; y: 20; minWidth: 120; maxWidth: 240
minHeight: 120; maxHeight: 240
- source: "colors.png"; margin: 30
+ source: "content/colors.png"; margin: 30
horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
}
MyBorderImage {
x: 520; y: 20; minWidth: 120; maxWidth: 240
minHeight: 120; maxHeight: 240
- source: "colors.png"; margin: 30
+ source: "content/colors.png"; margin: 30
horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
}
MyBorderImage {
x: 770; y: 20; minWidth: 120; maxWidth: 240
minHeight: 120; maxHeight: 240
- source: "colors.png"; margin: 30
+ source: "content/colors.png"; margin: 30
horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
}
MyBorderImage {
x: 20; y: 280; minWidth: 60; maxWidth: 200
minHeight: 40; maxHeight: 200
- source: "bw.png"; margin: 10
+ source: "content/bw.png"; margin: 10
}
MyBorderImage {
x: 270; y: 280; minWidth: 60; maxWidth: 200
minHeight: 40; maxHeight: 200
- source: "bw.png"; margin: 10
+ source: "content/bw.png"; margin: 10
horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
}
MyBorderImage {
x: 520; y: 280; minWidth: 60; maxWidth: 200
minHeight: 40; maxHeight: 200
- source: "bw.png"; margin: 10
+ source: "content/bw.png"; margin: 10
horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
}
MyBorderImage {
x: 770; y: 280; minWidth: 60; maxWidth: 200
minHeight: 40; maxHeight: 200
- source: "bw.png"; margin: 10
+ source: "content/bw.png"; margin: 10
horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
}
}
diff --git a/examples/declarative/border-image/borders.qml b/examples/declarative/border-image/borders.qml
index e90abe6..9879416 100644
--- a/examples/declarative/border-image/borders.qml
+++ b/examples/declarative/border-image/borders.qml
@@ -8,11 +8,11 @@ Rectangle {
BorderImage {
x: 20; y: 20; width: 230; height: 240
smooth: true
- source: "colors-stretch.sci"
+ source: "content/colors-stretch.sci"
}
BorderImage {
x: 270; y: 20; width: 230; height: 240
smooth: true
- source: "colors-round.sci"
+ source: "content/colors-round.sci"
}
}
diff --git a/examples/declarative/border-image/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml
index 9eb1270..9eb1270 100644
--- a/examples/declarative/border-image/MyBorderImage.qml
+++ b/examples/declarative/border-image/content/MyBorderImage.qml
diff --git a/examples/declarative/border-image/bw.png b/examples/declarative/border-image/content/bw.png
index 486eaae..486eaae 100644
--- a/examples/declarative/border-image/bw.png
+++ b/examples/declarative/border-image/content/bw.png
Binary files differ
diff --git a/examples/declarative/border-image/colors-round.sci b/examples/declarative/border-image/content/colors-round.sci
index 506f6f5..506f6f5 100644
--- a/examples/declarative/border-image/colors-round.sci
+++ b/examples/declarative/border-image/content/colors-round.sci
diff --git a/examples/declarative/border-image/colors-stretch.sci b/examples/declarative/border-image/content/colors-stretch.sci
index e4989a7..e4989a7 100644
--- a/examples/declarative/border-image/colors-stretch.sci
+++ b/examples/declarative/border-image/content/colors-stretch.sci
diff --git a/examples/declarative/border-image/colors.png b/examples/declarative/border-image/content/colors.png
index dfb62f3..dfb62f3 100644
--- a/examples/declarative/border-image/colors.png
+++ b/examples/declarative/border-image/content/colors.png
Binary files differ
diff --git a/examples/declarative/border-image/example.qml b/examples/declarative/border-image/example.qml
deleted file mode 100644
index 25c19d9..0000000
--- a/examples/declarative/border-image/example.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: page
- color: "white"
- width: 520; height: 280
-
- Row {
- 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: "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: "colors.png"
- }
-//! [0]
- }
-}
diff --git a/examples/declarative/clock/Clock.qml b/examples/declarative/clock/Clock.qml
deleted file mode 100644
index a061488..0000000
--- a/examples/declarative/clock/Clock.qml
+++ /dev/null
@@ -1,80 +0,0 @@
-import Qt 4.6
-
-Item {
- id: clock
- width: 200; height: 200
- property var time
- property var hours
- property var minutes
- property var seconds
- onTimeChanged: {
- var date = new Date;
- hours = date.getHours();
- minutes = date.getMinutes();
- seconds = date.getSeconds();
- }
- Timer {
- interval: 100; running: true; repeat: true; triggeredOnStart: true
- onTriggered: clock.time = new Date()
- }
-
- Image { source: "background.png" }
- Image {
- x: 95
- y: 54
- source: "hour.png"
- smooth: true
- transform: Rotation {
- id: hourRotation
- origin.x: 4; origin.y: 45
- angle: 0
- angle: SpringFollow {
- spring: 2
- damping: .2
- source: clock.hours * 50 * 3 + clock.minutes / 2
- }
- }
- }
- Image {
- x: 95
- y: 30
- source: "minute.png"
- smooth: true
- transform: Rotation {
- id: minuteRotation
- origin.x: 4; origin.y: 70
- angle: 0
- angle: SpringFollow {
- spring: 2
- damping: .2
- source: clock.minutes * 6
- }
- }
- }
- Image {
- x: 96
- y: 40
- source: "second.png"
- smooth: true
- transform: Rotation {
- id: secondRotation
- origin.x: 2; origin.y: 60
- angle: 0
- angle: SpringFollow {
- spring: 5
- damping: .25
- modulus: 360
- source: clock.seconds * 6
- }
- }
- }
-
- Rectangle {
- x: 93
- y: 94
- width: 11
- height: 11
- radius: 5
- color: "black"
- }
-}
diff --git a/examples/declarative/clock/display.qml b/examples/declarative/clock/display.qml
deleted file mode 100644
index 20e254d..0000000
--- a/examples/declarative/clock/display.qml
+++ /dev/null
@@ -1,7 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- width: childrenRect.width
- height: childrenRect.height
- Clock { id: clock }
-}
diff --git a/examples/declarative/clock/hour.png b/examples/declarative/clock/hour.png
deleted file mode 100644
index 603466b..0000000
--- a/examples/declarative/clock/hour.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/clock/minute.png b/examples/declarative/clock/minute.png
deleted file mode 100644
index 0207405..0000000
--- a/examples/declarative/clock/minute.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/clock/second.png b/examples/declarative/clock/second.png
deleted file mode 100644
index bfcef68..0000000
--- a/examples/declarative/clock/second.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/clocks/clocks.qml b/examples/declarative/clocks/clocks.qml
new file mode 100644
index 0000000..624748a
--- /dev/null
+++ b/examples/declarative/clocks/clocks.qml
@@ -0,0 +1,15 @@
+import Qt 4.6
+import "content"
+
+Rectangle {
+ width: childrenRect.width
+ height: childrenRect.height
+ color: "#646464"
+
+ Grid {
+ columns: 3
+ Clock { city: "New York"; shift: -4 }
+ Clock { city: "Mumbai"; shift: 5.5 }
+ Clock { city: "Tokyo"; shift: 9 }
+ }
+}
diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml
new file mode 100644
index 0000000..4e9984f
--- /dev/null
+++ b/examples/declarative/clocks/content/Clock.qml
@@ -0,0 +1,77 @@
+import Qt 4.6
+
+Item {
+ id: clock
+ width: 200; height: 230
+
+ property alias city: cityLabel.text
+ property var hours
+ property var minutes
+ property var seconds
+ property var shift : 0
+
+ function timeChanged() {
+ var date = new Date;
+ hours = date.getUTCHours() + Math.floor(clock.shift)
+ minutes = date.getUTCMinutes() + ((clock.shift % 1) * 60);
+ seconds = date.getUTCSeconds();
+ }
+
+ Timer {
+ interval: 1000; running: true; repeat: true; triggeredOnStart: true
+ onTriggered: clock.timeChanged()
+ }
+
+ Image { id: background; source: "clock.png" }
+
+ Image {
+ x: 92.5; y: 27
+ source: "hour.png"
+ smooth: true
+ transform: Rotation {
+ id: hourRotation
+ origin.x: 7.5; origin.y: 73; angle: 0
+ angle: SpringFollow {
+ spring: 2; damping: 0.2; modulus: 360
+ source: (clock.hours * 30) + (clock.minutes * 0.5)
+ }
+ }
+ }
+
+ Image {
+ x: 93.5; y: 17
+ source: "minute.png"
+ smooth: true
+ transform: Rotation {
+ id: minuteRotation
+ origin.x: 6.5; origin.y: 83; angle: 0
+ angle: SpringFollow {
+ spring: 2; damping: 0.2; modulus: 360
+ source: clock.minutes * 6
+ }
+ }
+ }
+
+ Image {
+ x: 97.5; y: 20
+ source: "second.png"
+ smooth: true
+ transform: Rotation {
+ id: secondRotation
+ origin.x: 2.5; origin.y: 80; angle: 0
+ angle: SpringFollow {
+ spring: 5; damping: 0.25; modulus: 360
+ source: clock.seconds * 6
+ }
+ }
+ }
+
+ Image {
+ anchors.centerIn: background; source: "center.png"
+ }
+
+ Text {
+ id: cityLabel; font.bold: true; font.pixelSize: 14; y:200; color: "white"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/declarative/clock/background.png b/examples/declarative/clocks/content/background.png
index a885950..a885950 100644
--- a/examples/declarative/clock/background.png
+++ b/examples/declarative/clocks/content/background.png
Binary files differ
diff --git a/examples/declarative/clocks/content/center.png b/examples/declarative/clocks/content/center.png
new file mode 100755
index 0000000..7fbd802
--- /dev/null
+++ b/examples/declarative/clocks/content/center.png
Binary files differ
diff --git a/examples/declarative/clocks/content/clock.png b/examples/declarative/clocks/content/clock.png
new file mode 100755
index 0000000..30bc577
--- /dev/null
+++ b/examples/declarative/clocks/content/clock.png
Binary files differ
diff --git a/examples/declarative/clocks/content/hour.png b/examples/declarative/clocks/content/hour.png
new file mode 100755
index 0000000..f8061a1
--- /dev/null
+++ b/examples/declarative/clocks/content/hour.png
Binary files differ
diff --git a/examples/declarative/clocks/content/minute.png b/examples/declarative/clocks/content/minute.png
new file mode 100755
index 0000000..1297ec7
--- /dev/null
+++ b/examples/declarative/clocks/content/minute.png
Binary files differ
diff --git a/examples/declarative/clocks/content/second.png b/examples/declarative/clocks/content/second.png
new file mode 100755
index 0000000..4aa9fb5
--- /dev/null
+++ b/examples/declarative/clocks/content/second.png
Binary files differ
diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml
index 5dc211e..07f71bb 100644
--- a/examples/declarative/connections/connections.qml
+++ b/examples/declarative/connections/connections.qml
@@ -1,7 +1,8 @@
import Qt 4.6
+import "content"
Rectangle {
- id: window; color: "#343434"
+ id: window; color: "#646464"
width: 640; height: 480
function turnLeft() {
@@ -12,16 +13,16 @@ Rectangle {
}
Image {
- id: image; source: "bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center
+ id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center
rotation: Behavior { NumberAnimation { easing: "easeOutCubic"; duration: 300 } }
}
Button {
- id: leftButton; image: "rotate-left.png"
+ id: leftButton; image: "content/rotate-left.png"
anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 10 }
}
Button {
- id: rightButton; image: "rotate-right.png"
+ id: rightButton; image: "content/rotate-right.png"
anchors { right: parent.right; bottom: parent.bottom; rightMargin: 10; bottomMargin: 10 }
}
diff --git a/examples/declarative/connections/Button.qml b/examples/declarative/connections/content/Button.qml
index 1d46acc..1d46acc 100644
--- a/examples/declarative/connections/Button.qml
+++ b/examples/declarative/connections/content/Button.qml
diff --git a/examples/declarative/connections/bg1.jpg b/examples/declarative/connections/content/bg1.jpg
index dfc7cee..dfc7cee 100644
--- a/examples/declarative/connections/bg1.jpg
+++ b/examples/declarative/connections/content/bg1.jpg
Binary files differ
diff --git a/examples/declarative/connections/rotate-left.png b/examples/declarative/connections/content/rotate-left.png
index c30387e..c30387e 100644
--- a/examples/declarative/connections/rotate-left.png
+++ b/examples/declarative/connections/content/rotate-left.png
Binary files differ
diff --git a/examples/declarative/connections/rotate-right.png b/examples/declarative/connections/content/rotate-right.png
index 1b05674..1b05674 100644
--- a/examples/declarative/connections/rotate-right.png
+++ b/examples/declarative/connections/content/rotate-right.png
Binary files differ
diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml
index ea4e0cd..0166b4c 100644
--- a/examples/declarative/dynamic/dynamic.qml
+++ b/examples/declarative/dynamic/dynamic.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import "qml"
Item {
id: window
@@ -71,26 +72,26 @@ Item {
PaletteItem{
anchors.verticalCenter: parent.verticalCenter
file: "Sun.qml";
- image: "images/sun.png"
+ image: "../images/sun.png"
}
PaletteItem{
file: "GenericItem.qml"
- image: "images/moon.png"
+ image: "../images/moon.png"
}
PaletteItem{
anchors.verticalCenter: parent.verticalCenter
file: "PerspectiveItem.qml"
- image: "images/tree_s.png"
+ image: "../images/tree_s.png"
}
PaletteItem{
anchors.verticalCenter: parent.verticalCenter
file: "PerspectiveItem.qml"
- image: "images/rabbit_brown.png"
+ image: "../images/rabbit_brown.png"
}
PaletteItem{
anchors.verticalCenter: parent.verticalCenter
file: "PerspectiveItem.qml"
- image: "images/rabbit_bw.png"
+ image: "../images/rabbit_bw.png"
}
}
Text{ text: "Active Suns: " + activeSuns }
@@ -108,7 +109,7 @@ Item {
}
Button {
text: "Create"
- onClicked: {var obj=createQmlObject(qmlText.text, window, 'CustomObject'); obj.parent=window;}
+ onClicked: createQmlObject(qmlText.text, window, 'CustomObject');
}
}
}
diff --git a/examples/declarative/dynamic/Button.qml b/examples/declarative/dynamic/qml/Button.qml
index 0b8b6db..2769cd8 100644
--- a/examples/declarative/dynamic/Button.qml
+++ b/examples/declarative/dynamic/qml/Button.qml
@@ -10,7 +10,7 @@ Rectangle {
height: text.height + 10
width: text.width + 20
border.width: 1
- radius: 4
+ radius: 4; smooth: true
gradient: Gradient {
GradientStop { position: 0.0;
color: if(!mr.pressed){activePalette.light;}else{activePalette.button;}
diff --git a/examples/declarative/dynamic/GenericItem.qml b/examples/declarative/dynamic/qml/GenericItem.qml
index 10e3dba..10e3dba 100644
--- a/examples/declarative/dynamic/GenericItem.qml
+++ b/examples/declarative/dynamic/qml/GenericItem.qml
diff --git a/examples/declarative/dynamic/PaletteItem.qml b/examples/declarative/dynamic/qml/PaletteItem.qml
index bb6036d..bb6036d 100644
--- a/examples/declarative/dynamic/PaletteItem.qml
+++ b/examples/declarative/dynamic/qml/PaletteItem.qml
diff --git a/examples/declarative/dynamic/PerspectiveItem.qml b/examples/declarative/dynamic/qml/PerspectiveItem.qml
index 9e09dd2..9e09dd2 100644
--- a/examples/declarative/dynamic/PerspectiveItem.qml
+++ b/examples/declarative/dynamic/qml/PerspectiveItem.qml
diff --git a/examples/declarative/dynamic/Sun.qml b/examples/declarative/dynamic/qml/Sun.qml
index a9f5d40..796a370 100644
--- a/examples/declarative/dynamic/Sun.qml
+++ b/examples/declarative/dynamic/qml/Sun.qml
@@ -3,7 +3,7 @@ import Qt 4.6
Image {
id: sun
property bool created: false
- property string image: "images/sun.png"
+ property string image: "../images/sun.png"
onCreatedChanged: if(created){window.activeSuns++;}else{window.activeSuns--;}
source: image;
@@ -18,7 +18,7 @@ Image {
}
states: State {
- name: "OffScreen"; when: created && y > window.height/2;//Below the ground
+ name: "OffScreen"; when: created && y > window.height / 2;//Below the ground
StateChangeScript { script: { sun.created = false; sun.destroy() } }
}
}
diff --git a/examples/declarative/dynamic/itemCreation.js b/examples/declarative/dynamic/qml/itemCreation.js
index 06e67c5..b3e8ba5 100644
--- a/examples/declarative/dynamic/itemCreation.js
+++ b/examples/declarative/dynamic/qml/itemCreation.js
@@ -32,6 +32,7 @@ function loadComponent() {
createItem();
itemComponent = createComponent(itemButton.file);
+ print(itemButton.file)
if(itemComponent.isLoading){
component.statusChanged.connect(finishCreation);
}else{//Depending on the content, it can be ready or error immediately