summaryrefslogtreecommitdiffstats
path: root/examples/declarative/clocks
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-10-30 01:50:47 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-10-30 01:50:47 (GMT)
commit72932c6683729071c1acb3f4832c5dc53a561bdd (patch)
tree3faaf9cae46f67e52108beb5902cab9c272b155e /examples/declarative/clocks
parentff1a4e75056b200b7eb9117ddfd5b6cd27f4e92e (diff)
downloadQt-72932c6683729071c1acb3f4832c5dc53a561bdd.zip
Qt-72932c6683729071c1acb3f4832c5dc53a561bdd.tar.gz
Qt-72932c6683729071c1acb3f4832c5dc53a561bdd.tar.bz2
cleanup
Diffstat (limited to 'examples/declarative/clocks')
-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.pngbin0 -> 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
8 files changed, 92 insertions, 0 deletions
diff --git a/examples/declarative/clocks/clocks.qml b/examples/declarative/clocks/clocks.qml
new file mode 100644
index 0000000..3235153
--- /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: "London" }
+ Clock { city: "Brisbane"; shift: 10 }
+ }
+}
diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml
new file mode 100644
index 0000000..636c99f
--- /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 int shift : 0
+
+ function timeChanged() {
+ var date = new Date;
+ hours = date.getUTCHours() + clock.shift
+ minutes = date.getUTCMinutes();
+ 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/clocks/content/background.png b/examples/declarative/clocks/content/background.png
new file mode 100644
index 0000000..a885950
--- /dev/null
+++ 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