aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmldelegatemodel/data/persistedItemsCache.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmldelegatemodel/data/persistedItemsCache.qml')
-rw-r--r--tests/auto/qml/qqmldelegatemodel/data/persistedItemsCache.qml62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmldelegatemodel/data/persistedItemsCache.qml b/tests/auto/qml/qqmldelegatemodel/data/persistedItemsCache.qml
new file mode 100644
index 0000000000..5ae2038e1f
--- /dev/null
+++ b/tests/auto/qml/qqmldelegatemodel/data/persistedItemsCache.qml
@@ -0,0 +1,62 @@
+import QtQuick
+import QtQuick.Window
+import QtQml.Models
+
+Window {
+ id: win
+ visible: true
+ width: 640
+ height: 480
+ property int destroyCount : 0;
+ property int createCount : 0;
+ property alias testListModel: mdl
+
+ DelegateModel {
+ id: visualModel
+ model: ListModel {
+ id: mdl
+ ListElement {
+ name: "a"
+ hidden: false
+ }
+ ListElement {
+ name: "b"
+ hidden: true
+ }
+ ListElement {
+ name: "c"
+ hidden: false
+ }
+ }
+
+ filterOnGroup: "selected"
+
+ groups: [
+ DelegateModelGroup {
+ name: "selected"
+ includeByDefault: true
+ }
+ ]
+
+ delegate: Text {
+ visible: DelegateModel.inSelected
+ property var idx
+ Component.onCompleted: {
+ ++createCount
+ idx = index
+ DelegateModel.inPersistedItems = true
+ DelegateModel.inSelected = !model.hidden
+ }
+ Component.onDestruction: ++destroyCount
+ text: model.name
+ }
+ }
+
+ ListView {
+ id: listView
+ model: visualModel
+ anchors.fill: parent
+ focus: true
+ }
+
+}