aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickgridview/data/multipleDisplaced.qml')
-rw-r--r--tests/auto/quick/qquickgridview/data/multipleDisplaced.qml81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml
new file mode 100644
index 0000000000..7c48bf39ae
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml
@@ -0,0 +1,81 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property var displaceTransitionsStarted: new Object()
+ property bool displaceTransitionsDone: false
+
+ objectName: "grid"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ model: testModel
+ delegate: myDelegate
+
+ displaced: Transition {
+ id: transition
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ var name = transition.ViewTransition.item.nameData
+ if (grid.displaceTransitionsStarted[name] == undefined)
+ grid.displaceTransitionsStarted[name] = 0
+ grid.displaceTransitionsStarted[name] += 1
+ }
+ }
+ NumberAnimation {
+ properties: "x,y"
+ duration: root.duration
+ easing.type: Easing.OutBounce
+ easing.amplitude: 10.0 // longer-lasting bounce to trigger bug
+ }
+ PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+}
+