From 7a0f9e754f76b052bf1474ec7c1d5f59b774de54 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 27 Oct 2009 15:05:36 +1000 Subject: Update parallax example --- examples/declarative/parallax/ParallaxView.qml | 64 ++- examples/declarative/parallax/parallax.qml | 18 +- examples/declarative/parallax/pics/home-page.svg | 445 +++++++++++++++++++++ .../declarative/parallax/pics/yast-joystick.png | Bin 0 -> 2723 bytes examples/declarative/parallax/pics/yast-wol.png | Bin 0 -> 3769 bytes 5 files changed, 523 insertions(+), 4 deletions(-) create mode 100644 examples/declarative/parallax/pics/home-page.svg create mode 100644 examples/declarative/parallax/pics/yast-joystick.png create mode 100644 examples/declarative/parallax/pics/yast-wol.png diff --git a/examples/declarative/parallax/ParallaxView.qml b/examples/declarative/parallax/ParallaxView.qml index 38bb8c0..1708ad1 100644 --- a/examples/declarative/parallax/ParallaxView.qml +++ b/examples/declarative/parallax/ParallaxView.qml @@ -1,7 +1,11 @@ import Qt 4.6 Item { + id: root + property alias background: background.source + default property alias content: visualModel.children + property int currentIndex: 0 Image { id: background @@ -10,9 +14,12 @@ Item { width: Math.max(list.viewportWidth, parent.width) } - default property alias content: visualModel.children ListView { id: list + + currentIndex: root.currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex + orientation: "Horizontal" overShoot: false anchors.fill: parent @@ -23,4 +30,59 @@ Item { preferredHighlightEnd: 0 highlightRangeMode: "StrictlyEnforceRange" } + + ListView { + id: selector + + currentIndex: root.currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex + + height: 50 + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + width: Math.min(count * 50, parent.width - 20) + interactive: width == parent.width - 20 + orientation: "Horizontal" + + delegate: Item { + width: 50; height: 50 + id: delegateRoot + + Image { + id: image + source: modelData.icon + smooth: true + scale: 0.8 + transformOrigin: "Center" + } + + MouseRegion { + anchors.fill: parent + onClicked: { root.currentIndex = index } + } + + states: State { + name: "Selected" + when: delegateRoot.ListView.isCurrentItem == true + PropertyChanges { + target: image + scale: 1 + y: -5 + } + } + transitions: Transition { + NumberAnimation { + properties: "scale,y" + } + } + } + model: visualModel.children + + Rectangle { + color: "#40FFFFFF" + x: -10; + y: -10; + width: parent.width + 20; height: parent.height + 10 + } + } } diff --git a/examples/declarative/parallax/parallax.qml b/examples/declarative/parallax/parallax.qml index b2139ec..52bd210 100644 --- a/examples/declarative/parallax/parallax.qml +++ b/examples/declarative/parallax/parallax.qml @@ -2,14 +2,18 @@ import Qt 4.6 import "../clock" Rectangle { + id: root + width: 320 height: 480 ParallaxView { + id: parallax anchors.fill: parent background: "pics/background.jpg" Item { + property url icon: "pics/yast-wol.png" width: 320 height: 480 @@ -19,6 +23,8 @@ Rectangle { } Item { + property url icon: "pics/home-page.svg" + width: 320 height: 480 @@ -26,18 +32,24 @@ Rectangle { } Item { + property url icon: "pics/yast-joystick.png" + width: 320 height: 480 Loader { - anchors.centerIn: parent - width: 300; height: 460 + anchors.top: parent.top + anchors.topMargin: 10 + anchors.horizontalCenter: parent.horizontalCenter + + width: 300; height: 400 clip: true resizeMode: Loader.SizeItemToLoader source: "../../../demos/declarative/samegame/samegame.qml" } } - } + currentIndex: root.currentIndex + } } diff --git a/examples/declarative/parallax/pics/home-page.svg b/examples/declarative/parallax/pics/home-page.svg new file mode 100644 index 0000000..4f16958 --- /dev/null +++ b/examples/declarative/parallax/pics/home-page.svg @@ -0,0 +1,445 @@ + +image/svg+xmlGo HomeJakub Steinerhttp://jimmac.musichall.czhomereturngodefaultuserdirectoryTuomas Kuosmanen + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/declarative/parallax/pics/yast-joystick.png b/examples/declarative/parallax/pics/yast-joystick.png new file mode 100644 index 0000000..858cea0 Binary files /dev/null and b/examples/declarative/parallax/pics/yast-joystick.png differ diff --git a/examples/declarative/parallax/pics/yast-wol.png b/examples/declarative/parallax/pics/yast-wol.png new file mode 100644 index 0000000..7712180 Binary files /dev/null and b/examples/declarative/parallax/pics/yast-wol.png differ -- cgit v0.12