diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-27 05:05:36 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-27 05:05:36 (GMT) |
commit | 7a0f9e754f76b052bf1474ec7c1d5f59b774de54 (patch) | |
tree | 0946cfa453463bc30dfd4a228dd16eda04f120fd /examples/declarative/parallax/ParallaxView.qml | |
parent | af7a8523d28539f719d3e3b82d7cf6628bbdd74a (diff) | |
download | Qt-7a0f9e754f76b052bf1474ec7c1d5f59b774de54.zip Qt-7a0f9e754f76b052bf1474ec7c1d5f59b774de54.tar.gz Qt-7a0f9e754f76b052bf1474ec7c1d5f59b774de54.tar.bz2 |
Update parallax example
Diffstat (limited to 'examples/declarative/parallax/ParallaxView.qml')
-rw-r--r-- | examples/declarative/parallax/ParallaxView.qml | 64 |
1 files changed, 63 insertions, 1 deletions
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 + } + } } |