summaryrefslogtreecommitdiffstats
path: root/examples/declarative/modelviews/parallax
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/modelviews/parallax')
-rw-r--r--examples/declarative/modelviews/parallax/parallax.qml6
-rw-r--r--examples/declarative/modelviews/parallax/qml/ParallaxView.qml30
-rw-r--r--examples/declarative/modelviews/parallax/qml/Smiley.qml18
3 files changed, 24 insertions, 30 deletions
diff --git a/examples/declarative/modelviews/parallax/parallax.qml b/examples/declarative/modelviews/parallax/parallax.qml
index 3b5c70a..19eadd0 100644
--- a/examples/declarative/modelviews/parallax/parallax.qml
+++ b/examples/declarative/modelviews/parallax/parallax.qml
@@ -39,12 +39,10 @@
****************************************************************************/
import Qt 4.7
-import "../../toys/clocks/content"
+import "../../toys/clocks/content" // for loading the Clock element
import "qml"
Rectangle {
- id: root
-
width: 320; height: 480
ParallaxView {
@@ -76,7 +74,5 @@ Rectangle {
Component.onCompleted: item.inAnotherDemo = true;
}
}
-
- currentIndex: root.currentIndex
}
}
diff --git a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml
index adf0885..ac479f4 100644
--- a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml
+++ b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml
@@ -44,8 +44,8 @@ Item {
id: root
property alias background: background.source
- default property alias content: visualModel.children
property int currentIndex: 0
+ default property alias content: visualModel.children
Image {
id: background
@@ -56,13 +56,13 @@ Item {
ListView {
id: list
+ anchors.fill: parent
currentIndex: root.currentIndex
onCurrentIndexChanged: root.currentIndex = currentIndex
orientation: Qt.Horizontal
boundsBehavior: Flickable.DragOverBounds
- anchors.fill: parent
model: VisualItemModel { id: visualModel }
highlightRangeMode: ListView.StrictlyEnforceRange
@@ -72,14 +72,6 @@ Item {
ListView {
id: selector
- Rectangle {
- color: "#60FFFFFF"
- x: -10; y: -10; radius: 10; z: -1
- width: parent.width + 20; height: parent.height + 20
- }
- currentIndex: root.currentIndex
- onCurrentIndexChanged: root.currentIndex = currentIndex
-
height: 50
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
@@ -87,6 +79,10 @@ Item {
interactive: width == parent.width - 20
orientation: Qt.Horizontal
+ currentIndex: root.currentIndex
+ onCurrentIndexChanged: root.currentIndex = currentIndex
+
+ model: visualModel.children
delegate: Item {
width: 50; height: 50
id: delegateRoot
@@ -113,11 +109,15 @@ Item {
}
}
transitions: Transition {
- NumberAnimation {
- properties: "scale,y"
- }
- }
+ NumberAnimation { properties: "scale,y" }
+ }
+ }
+
+ Rectangle {
+ color: "#60FFFFFF"
+ x: -10; y: -10; z: -1
+ width: parent.width + 20; height: parent.height + 20
+ radius: 10
}
- model: visualModel.children
}
}
diff --git a/examples/declarative/modelviews/parallax/qml/Smiley.qml b/examples/declarative/modelviews/parallax/qml/Smiley.qml
index 8399664..3ca672a 100644
--- a/examples/declarative/modelviews/parallax/qml/Smiley.qml
+++ b/examples/declarative/modelviews/parallax/qml/Smiley.qml
@@ -40,16 +40,18 @@
import Qt 4.7
+// This is taken from the declarative animation/basics/property-animation.qml
+// example
+
Item {
id: window
width: 320; height: 480
- // The shadow for the smiley face
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: "../pics/shadow.png"; y: smiley.minHeight + 58
+ y: smiley.minHeight + 58
+ source: "../pics/shadow.png"
- // The scale property depends on the y position of the smiley face.
scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight)
}
@@ -59,26 +61,22 @@ Item {
property int minHeight: 2 * window.height / 3
anchors.horizontalCenter: parent.horizontalCenter
- source: "../pics/face-smile.png"; y: minHeight
+ y: minHeight
+ source: "../pics/face-smile.png"
- // Animate the y property. Setting repeat to true makes the
- // animation repeat indefinitely, otherwise it would only run once.
- SequentialAnimation on y {
+ SequentialAnimation on y {
loops: Animation.Infinite
- // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function
NumberAnimation {
from: smiley.minHeight; to: smiley.maxHeight
easing.type: Easing.OutExpo; duration: 300
}
- // Then move back to minHeight in 1 second, using the OutBounce easing function
NumberAnimation {
from: smiley.maxHeight; to: smiley.minHeight
easing.type: Easing.OutBounce; duration: 1000
}
- // Then pause for 500ms
PauseAnimation { duration: 500 }
}
}