diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-07-20 00:14:38 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-07-20 00:14:38 (GMT) |
commit | 17cc89e918a969d85d2b46631ee8743288c7586d (patch) | |
tree | 5157d7cd27194144440277aaca93167c12d67c4f /tests/auto/declarative/qdeclarativerepeater/data | |
parent | cc08942aa57877fd4b8e309088ffe9b28a7deeb8 (diff) | |
download | Qt-17cc89e918a969d85d2b46631ee8743288c7586d.zip Qt-17cc89e918a969d85d2b46631ee8743288c7586d.tar.gz Qt-17cc89e918a969d85d2b46631ee8743288c7586d.tar.bz2 |
Ensure released VisualItemModel items are removed from the scene.
Also parent them back to the VIM to ensure correct destruction.
Task-number: QTBUG-12261
Diffstat (limited to 'tests/auto/declarative/qdeclarativerepeater/data')
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml index e8dd8cc..4810736 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml @@ -4,21 +4,27 @@ import Qt 4.7 Rectangle { + id: root color: "lightgray" width: 240 height: 320 + property variant itemModel: itemModel1 function checkProperties() { testObject.error = false; - if (testObject.useModel && view.model != itemModel) { + if (testObject.useModel && view.model != root.itemModel) { console.log("model property incorrect"); testObject.error = true; } } + function switchModel() { + root.itemModel = itemModel2 + } + VisualItemModel { - id: itemModel - objectName: "itemModel" + id: itemModel1 + objectName: "itemModel1" Rectangle { objectName: "item1" height: 50; width: 100; color: "#FFFEF0" @@ -36,12 +42,27 @@ Rectangle { } } + VisualItemModel { + id: itemModel2 + objectName: "itemModel2" + Rectangle { + objectName: "item4" + height: 50; width: 100; color: "#FFFEF0" + Text { objectName: "text4"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item5" + height: 50; width: 100; color: "#F0FFF7" + Text { objectName: "text5"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + } + Column { objectName: "container" Repeater { id: view objectName: "repeater" - model: testObject.useModel ? itemModel : 0 + model: testObject.useModel ? root.itemModel : 0 } } } |