summaryrefslogtreecommitdiffstats
path: root/examples/declarative/clocks
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-02 04:33:53 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-02 04:33:53 (GMT)
commit3dd28725a32c5eae6fa05c2bbe309c7919671cdc (patch)
tree8179f7ec2ac3437388a7c4753f1654894ed2bca2 /examples/declarative/clocks
parent1795271ac03a8662ff0eac153c63c3d562f91921 (diff)
downloadQt-3dd28725a32c5eae6fa05c2bbe309c7919671cdc.zip
Qt-3dd28725a32c5eae6fa05c2bbe309c7919671cdc.tar.gz
Qt-3dd28725a32c5eae6fa05c2bbe309c7919671cdc.tar.bz2
add night support for clocks example
Diffstat (limited to 'examples/declarative/clocks')
-rw-r--r--examples/declarative/clocks/content/Clock.qml5
-rwxr-xr-xexamples/declarative/clocks/content/clock-night.pngbin0 -> 23359 bytes
-rwxr-xr-xexamples/declarative/clocks/content/clock.pngbin21780 -> 20653 bytes
3 files changed, 4 insertions, 1 deletions
diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml
index 2aac5f1..0c6836f 100644
--- a/examples/declarative/clocks/content/Clock.qml
+++ b/examples/declarative/clocks/content/Clock.qml
@@ -9,10 +9,12 @@ Item {
property var minutes
property var seconds
property var shift : 0
+ property bool night: false
function timeChanged() {
var date = new Date;
hours = shift ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours()
+ if ( hours < 7 || hours > 19 ) night = true; else night = false
minutes = shift ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes()
seconds = date.getUTCSeconds();
}
@@ -22,7 +24,8 @@ Item {
onTriggered: clock.timeChanged()
}
- Image { id: background; source: "clock.png" }
+ Image { id: background; source: "clock.png"; visible: clock.night == false }
+ Image { source: "clock-night.png"; visible: clock.night == true }
Image {
x: 92.5; y: 27
diff --git a/examples/declarative/clocks/content/clock-night.png b/examples/declarative/clocks/content/clock-night.png
new file mode 100755
index 0000000..cc7151a
--- /dev/null
+++ b/examples/declarative/clocks/content/clock-night.png
Binary files differ
diff --git a/examples/declarative/clocks/content/clock.png b/examples/declarative/clocks/content/clock.png
index 30bc577..462edac 100755
--- a/examples/declarative/clocks/content/clock.png
+++ b/examples/declarative/clocks/content/clock.png
Binary files differ