diff options
author | Morten Engvoldsen <morten.engvoldsen@nokia.com> | 2010-05-12 15:01:55 (GMT) |
---|---|---|
committer | Morten Engvoldsen <morten.engvoldsen@nokia.com> | 2010-05-12 15:01:55 (GMT) |
commit | d41ccae68683dd0d35c20affec7e5c55ce6bca37 (patch) | |
tree | 270fe804f2b130243da4e714cc1a135690bc466d /examples/declarative/dynamic/qml/PerspectiveItem.qml | |
parent | 5987412720498aa22202a1bcca3cb988a9cf5606 (diff) | |
parent | 41cbfc5c8e6644ab21e92860db95b2e8da9aba6a (diff) | |
download | Qt-d41ccae68683dd0d35c20affec7e5c55ce6bca37.zip Qt-d41ccae68683dd0d35c20affec7e5c55ce6bca37.tar.gz Qt-d41ccae68683dd0d35c20affec7e5c55ce6bca37.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'examples/declarative/dynamic/qml/PerspectiveItem.qml')
-rw-r--r-- | examples/declarative/dynamic/qml/PerspectiveItem.qml | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/examples/declarative/dynamic/qml/PerspectiveItem.qml b/examples/declarative/dynamic/qml/PerspectiveItem.qml index 3cbe64a..c04d3dc 100644 --- a/examples/declarative/dynamic/qml/PerspectiveItem.qml +++ b/examples/declarative/dynamic/qml/PerspectiveItem.qml @@ -1,16 +1,25 @@ import Qt 4.7 Image { - id: tree + id: rootItem + property bool created: false - property double scaleFactor: Math.max((y+height-250)*0.01, 0.3) - property double scaledBottom: y + (height+height*scaleFactor)/2 - property bool onLand: scaledBottom > window.height/2 - property string image //Needed for compatibility with GenericItem + property string image + + property double scaledBottom: y + (height + height*scale) / 2 + property bool onLand: scaledBottom > window.height / 2 + + source: image opacity: onLand ? 1 : 0.25 - onCreatedChanged: if (created && !onLand) { tree.destroy() } else { z = scaledBottom } - scale: scaleFactor - transformOrigin: "Center" - source: image; smooth: true - onYChanged: z = scaledBottom + scale: Math.max((y + height - 250) * 0.01, 0.3) + smooth: true + + onCreatedChanged: { + if (created && !onLand) + rootItem.destroy(); + else + z = scaledBottom; + } + + onYChanged: z = scaledBottom; } |