From abf60e8e075ecbf2c14e84d40fecff973dd124c7 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 30 Oct 2009 15:13:19 +1000 Subject: cleanup --- examples/declarative/parallax/ParallaxView.qml | 89 ---------------------- examples/declarative/parallax/Smiley.qml | 47 ------------ examples/declarative/parallax/parallax.qml | 1 + examples/declarative/parallax/qml/ParallaxView.qml | 89 ++++++++++++++++++++++ examples/declarative/parallax/qml/Smiley.qml | 47 ++++++++++++ 5 files changed, 137 insertions(+), 136 deletions(-) delete mode 100644 examples/declarative/parallax/ParallaxView.qml delete mode 100644 examples/declarative/parallax/Smiley.qml create mode 100644 examples/declarative/parallax/qml/ParallaxView.qml create mode 100644 examples/declarative/parallax/qml/Smiley.qml diff --git a/examples/declarative/parallax/ParallaxView.qml b/examples/declarative/parallax/ParallaxView.qml deleted file mode 100644 index ac84b47..0000000 --- a/examples/declarative/parallax/ParallaxView.qml +++ /dev/null @@ -1,89 +0,0 @@ -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 - fillMode: Image.TileHorizontally - x: -list.viewportX / 2 - width: Math.max(list.viewportWidth, parent.width) - } - - ListView { - id: list - - currentIndex: root.currentIndex - onCurrentIndexChanged: root.currentIndex = currentIndex - - orientation: "Horizontal" - overShoot: false - anchors.fill: parent - model: VisualItemModel { id: visualModel } - - highlight: Rectangle { height: 1; width: 1 } - highlightMoveSpeed: 2000 - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightRangeMode: "StrictlyEnforceRange" - - flickDeceleration: 1000 - } - - 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 - 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 - } -} diff --git a/examples/declarative/parallax/Smiley.qml b/examples/declarative/parallax/Smiley.qml deleted file mode 100644 index db87412..0000000 --- a/examples/declarative/parallax/Smiley.qml +++ /dev/null @@ -1,47 +0,0 @@ -import Qt 4.6 - -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 - transformOrigin: Item.Center - - // The scale property depends on the y position of the smiley face. - scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) - } - - Image { - id: smiley - property int maxHeight: window.height / 3 - property int minHeight: 2 * window.height / 3 - - anchors.horizontalCenter: parent.horizontalCenter - source: "pics/face-smile.png"; y: minHeight - - // Animate the y property. Setting repeat to true makes the - // animation repeat indefinitely, otherwise it would only run once. - y: SequentialAnimation { - running: true; repeat: true - - // Move from minHeight to maxHeight in 300ms, using the easeOutExpo easing function - NumberAnimation { - from: smiley.minHeight; to: smiley.maxHeight - easing: "easeOutExpo"; duration: 300 - } - - // Then move back to minHeight in 1 second, using the easeOutBounce easing function - NumberAnimation { - from: smiley.maxHeight; to: smiley.minHeight - easing: "easeOutBounce"; duration: 1000 - } - - // Then pause for 500ms - PauseAnimation { duration: 500 } - } - } -} - diff --git a/examples/declarative/parallax/parallax.qml b/examples/declarative/parallax/parallax.qml index b64f15f..6193f27 100644 --- a/examples/declarative/parallax/parallax.qml +++ b/examples/declarative/parallax/parallax.qml @@ -1,5 +1,6 @@ import Qt 4.6 import "../clocks/content" +import "qml" Rectangle { id: root diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml new file mode 100644 index 0000000..ac84b47 --- /dev/null +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -0,0 +1,89 @@ +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 + fillMode: Image.TileHorizontally + x: -list.viewportX / 2 + width: Math.max(list.viewportWidth, parent.width) + } + + ListView { + id: list + + currentIndex: root.currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex + + orientation: "Horizontal" + overShoot: false + anchors.fill: parent + model: VisualItemModel { id: visualModel } + + highlight: Rectangle { height: 1; width: 1 } + highlightMoveSpeed: 2000 + preferredHighlightBegin: 0 + preferredHighlightEnd: 0 + highlightRangeMode: "StrictlyEnforceRange" + + flickDeceleration: 1000 + } + + 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 + 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 + } +} diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml new file mode 100644 index 0000000..e8917f6 --- /dev/null +++ b/examples/declarative/parallax/qml/Smiley.qml @@ -0,0 +1,47 @@ +import Qt 4.6 + +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 + transformOrigin: Item.Center + + // The scale property depends on the y position of the smiley face. + scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) + } + + Image { + id: smiley + property int maxHeight: window.height / 3 + property int minHeight: 2 * window.height / 3 + + anchors.horizontalCenter: parent.horizontalCenter + source: "../pics/face-smile.png"; y: minHeight + + // Animate the y property. Setting repeat to true makes the + // animation repeat indefinitely, otherwise it would only run once. + y: SequentialAnimation { + running: true; repeat: true + + // Move from minHeight to maxHeight in 300ms, using the easeOutExpo easing function + NumberAnimation { + from: smiley.minHeight; to: smiley.maxHeight + easing: "easeOutExpo"; duration: 300 + } + + // Then move back to minHeight in 1 second, using the easeOutBounce easing function + NumberAnimation { + from: smiley.maxHeight; to: smiley.minHeight + easing: "easeOutBounce"; duration: 1000 + } + + // Then pause for 500ms + PauseAnimation { duration: 500 } + } + } +} + -- cgit v0.12