aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/data/animatedDelegate.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicklistview/data/animatedDelegate.qml')
-rw-r--r--tests/auto/quick/qquicklistview/data/animatedDelegate.qml35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/animatedDelegate.qml b/tests/auto/quick/qquicklistview/data/animatedDelegate.qml
new file mode 100644
index 0000000000..46913d87d7
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/animatedDelegate.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.12
+
+Item {
+ width: 640
+ height: 480
+
+ property var moreModel: [myDataModelContainer.createObject(null)]
+ property Component myDataModelContainer: Component {
+ QtObject {}
+ }
+
+ function refreshModel() {
+ //copy contents of moreModel
+ var list = moreModel.slice()
+
+ moreModel = [myDataModelContainer.createObject(null), myDataModelContainer.createObject(null)]
+
+ for (var i = 0; i < list.length; i++) {
+ //console.log("trying to destroy ="+list[i])
+ list[i].destroy()
+ }
+ }
+
+ ListView {
+ id: listView
+ objectName: "listView"
+ anchors.fill: parent
+ model: moreModel
+ focus: true
+
+ delegate: AnimatedButton {
+ color: ListView.isCurrentItem ? "red" : "black"
+ }
+ }
+}