Replace obsolete VisualDataModel, *Group and VisualItemModel in tests

VisualDataModel, VisualDataGroup, and VisualItemModel
are replaced with DelegateModel, DelegateModelGroup, and ObjectModel
respectively (since 7cad0e52c5).

git grep -l 'VisualDataModel' | xargs sed -i 's/VisualDataModel/DelegateModel/g'
git grep -l 'VisualDataGroup' | xargs sed -i 's/VisualDataGroup/DelegateModelGroup/g'
git grep -l 'VisualItemModel' | xargs sed -i 's/VisualItemModel/ObjectModel/g'

Change-Id: Ie91b37b204f08a5d1f1f38594fb22ed70a6e2080
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Shawn Rutledge 2018-10-03 08:55:13 +02:00
parent 2dda8dcb2f
commit b22cb209e7
42 changed files with 279 additions and 239 deletions

View File

@ -2,29 +2,30 @@
// changes in right-to-left layout direction
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 340
height: 370
VisualItemModel {
ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: 110; width: 120; color: "#FFFEF0"
Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: 130; width: 150; color: "#F0FFF7"
Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: 170; width: 190; color: "#F4F0FF"
Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Item {
width: 240
@ -38,7 +39,7 @@ Item {
}
VisualDataModel {
DelegateModel {
id: visualModel
delegate: myDelegate

View File

@ -1,33 +1,34 @@
// This example demonstrates placing items in a view using
// a VisualItemModel
// an ObjectModel
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 240
height: 320
VisualItemModel {
ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: view.height / 3
width: view.width; color: "#FFFEF0"
Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: view.height / 3
width: view.width; color: "#F0FFF7"
Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: view.height / 3
width: view.width; color: "#F4F0FF"
Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}

View File

@ -1,33 +1,34 @@
// This example demonstrates placing items in a view using
// a VisualItemModel
// an ObjectModel
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 240
height: 320
VisualItemModel {
ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#FFFEF0"
Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#F0FFF7"
Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#F4F0FF"
Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
width: 240
@ -54,7 +55,7 @@ Rectangle {
}
}
},
VisualDataModel {
DelegateModel {
id: visualModel
model: testModel
delegate: myDelegate

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
id: root
@ -120,7 +121,7 @@ Rectangle {
id: headerFooter
Rectangle { height: 30; width: 240; color: "blue" }
},
VisualDataModel {
DelegateModel {
id: visualModel
model: testModel

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
id: root
@ -9,7 +10,7 @@ ListView {
layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
verticalLayoutDirection: (testBottomToTop == true) ? ListView.BottomToTop : ListView.TopToBottom
model: VisualItemModel {
model: ObjectModel {
Rectangle {
objectName: "red"
width: 200; height: 200; color: "red"

View File

@ -2,29 +2,30 @@
// changes in right-to-left layout direction
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 640
height: 320
VisualItemModel {
ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: view.height; width: 100; color: "#FFFEF0"
Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: view.height; width: 200; color: "#F0FFF7"
Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: view.height; width: 240; color: "#F4F0FF"
Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Item {
width: 240
@ -34,7 +35,7 @@ Item {
}
VisualDataModel {
DelegateModel {
id: visualModel
delegate: myDelegate

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -465,7 +465,7 @@ void tst_QQuickListView::items(const QUrl &source)
T model2;
ctxt->setContextProperty("testModel", &model2);
// Force a layout, necessary if ListView is completed before VisualDataModel.
// Force a layout, necessary if ListView is completed before DelegateModel.
listview->forceLayout();
int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
@ -504,7 +504,7 @@ void tst_QQuickListView::changed(const QUrl &source)
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != nullptr);
// Force a layout, necessary if ListView is completed before VisualDataModel.
// Force a layout, necessary if ListView is completed before DelegateModel.
listview->forceLayout();
model.modifyItem(1, "Will", "9876");

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Item {
id: root
@ -6,7 +7,7 @@ Item {
property bool enforceRange: false
width: 320; height: 480
VisualItemModel {
ObjectModel {
id: itemModel
Rectangle {

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Item {
width: 800; height: 600
@ -37,7 +38,7 @@ Item {
ListElement { lColor: "brown" }
ListElement { lColor: "thistle" }
}
VisualDataModel { id: visualModel; model: rssModel; delegate: photoDelegate }
DelegateModel { id: visualModel; model: rssModel; delegate: photoDelegate }
PathView {
id: photoPathView

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
PathView {
width: 320
@ -6,7 +7,7 @@ PathView {
function setRoot(index) {
vdm.rootIndex = vdm.modelIndex(index);
}
model: VisualDataModel {
model: DelegateModel {
id: vdm
model: myModel
delegate: Text { objectName: "wrapper"; text: display }

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
PathView {
id: pathView
@ -20,7 +21,7 @@ PathView {
ListElement { value: "three" }
}
model: VisualDataModel {
model: DelegateModel {
delegate: Text { text: model.value }
model : mo
}

View File

@ -1,7 +1,8 @@
// This example demonstrates placing items in a view using
// a VisualItemModel
// an ObjectModel
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
id: root
@ -22,38 +23,38 @@ Rectangle {
root.itemModel = itemModel2
}
VisualItemModel {
ObjectModel {
id: itemModel1
objectName: "itemModel1"
Rectangle {
objectName: "item1"
height: 50; width: 100; color: "#FFFEF0"
Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: 50; width: 100; color: "#F0FFF7"
Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: 50; width: 100; color: "#F4F0FF"
Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
VisualItemModel {
ObjectModel {
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 }
Text { objectName: "text4"; text: "index: " + parent.ObjectModel.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 }
Text { objectName: "text5"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}

View File

@ -1,10 +1,11 @@
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
width: 360
height: 360
VisualItemModel {
ObjectModel {
id: visItemModel
Rectangle {
width: 20

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
width: 200
@ -6,7 +7,7 @@ ListView {
property var persistentHandle
model: VisualDataModel {
model: DelegateModel {
id: visualModel
persistedItems.includeByDefault: true

View File

@ -1,10 +1,11 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
width: 100
height: 100
model: visualModel.parts.package
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
model: myModel

View File

@ -1,9 +1,10 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
width: 100
height: 100
model: VisualDataModel {
model: DelegateModel {
id: visualModel
objectName: "visualModel"
model: myModel

View File

@ -1,14 +1,15 @@
import QtQuick 2.0
import QtQml.Models 2.12
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" },
VisualDataGroup { id: unnamed; objectName: "unnamed" },
VisualDataGroup { id: capitalised; objectName: "capitalised"; name: "Capitalised" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" },
DelegateModelGroup { id: unnamed; objectName: "unnamed" },
DelegateModelGroup { id: capitalised; objectName: "capitalised"; name: "Capitalised" }
]
}

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
width: 100
@ -12,14 +13,14 @@ ListView {
}
model: visualModel.parts.package
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: myModel
@ -28,16 +29,16 @@ ListView {
property variant test1: name
property variant test2: index
property variant test3: VisualDataModel.itemsIndex
property variant test4: VisualDataModel.inItems
property variant test5: VisualDataModel.visibleIndex
property variant test6: VisualDataModel.inVisible
property variant test7: VisualDataModel.selectedIndex
property variant test8: VisualDataModel.inSelected
property variant test9: VisualDataModel.groups
property variant test3: DelegateModel.itemsIndex
property variant test4: DelegateModel.inItems
property variant test5: DelegateModel.visibleIndex
property variant test6: DelegateModel.inVisible
property variant test7: DelegateModel.selectedIndex
property variant test8: DelegateModel.inSelected
property variant test9: DelegateModel.groups
function hide() { VisualDataModel.inVisible = false }
function select() { VisualDataModel.inSelected = true }
function hide() { DelegateModel.inVisible = false }
function select() { DelegateModel.inSelected = true }
Item {
Package.name: "package"

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
width: 100
@ -12,14 +13,14 @@ ListView {
}
model: visualModel
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: myModel
@ -31,16 +32,16 @@ ListView {
height: 2
property variant test1: name
property variant test2: index
property variant test3: VisualDataModel.itemsIndex
property variant test4: VisualDataModel.inItems
property variant test5: VisualDataModel.visibleIndex
property variant test6: VisualDataModel.inVisible
property variant test7: VisualDataModel.selectedIndex
property variant test8: VisualDataModel.inSelected
property variant test9: VisualDataModel.groups
property variant test3: DelegateModel.itemsIndex
property variant test4: DelegateModel.inItems
property variant test5: DelegateModel.visibleIndex
property variant test6: DelegateModel.inVisible
property variant test7: DelegateModel.selectedIndex
property variant test8: DelegateModel.inSelected
property variant test9: DelegateModel.groups
function hide() { VisualDataModel.inVisible = false }
function select() { VisualDataModel.inSelected = true }
function hide() { DelegateModel.inVisible = false }
function select() { DelegateModel.inSelected = true }
}
}
}

View File

@ -1,15 +1,16 @@
import QtQuick 2.0
import QtQml.Models 2.12
Item {
property VisualDataModel invalidVdm: VisualDataModel.model
property DelegateModel invalidVdm: DelegateModel.model
Repeater {
model: 1
delegate: Item {
id: outer
objectName: "delegate"
property VisualDataModel validVdm: outer.VisualDataModel.model
property VisualDataModel invalidVdm: inner.VisualDataModel.model
property DelegateModel validVdm: outer.DelegateModel.model
property DelegateModel invalidVdm: inner.DelegateModel.model
Item {
id: inner

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Item {
width: 100
@ -9,7 +10,7 @@ Item {
model: visualModel.parts.list
}
VisualDataModel {
DelegateModel {
id: visualModel
model: myModel

View File

@ -1,17 +1,18 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
width: 100
height: 100
model: visualModel.parts.package
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: ListModel {

View File

@ -1,15 +1,16 @@
import QtQuick 2.0
import QtQml.Models 2.12
ListView {
width: 100
height: 100
model: VisualDataModel {
model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: ListModel {

View File

@ -1,17 +1,18 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: visualModel.parts.package
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: StandardItemModel {

View File

@ -1,16 +1,17 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: VisualDataModel {
model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: StandardItemModel {

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
@ -6,7 +7,7 @@ ListView {
height: 100
model: visualModel.parts.package
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
@ -18,8 +19,8 @@ ListView {
]
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: objects

View File

@ -1,10 +1,11 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: VisualDataModel {
model: DelegateModel {
id: visualModel
objectName: "visualModel"
@ -16,8 +17,8 @@ ListView {
]
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: objects

View File

@ -1,6 +1,7 @@
import QtQuick 2.0
import QtQml.Models 2.12
VisualDataModel {
DelegateModel {
id: vm
property var inserted
@ -42,7 +43,7 @@ VisualDataModel {
}
groups: [
VisualDataGroup {
DelegateModelGroup {
id: vi;
property var inserted
@ -56,7 +57,7 @@ VisualDataModel {
vi.removed = removed
}
},
VisualDataGroup {
DelegateModelGroup {
id: si;
property var inserted

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
Item {
width: 240
@ -34,7 +35,7 @@ Item {
}
VisualDataModel {
DelegateModel {
id: visualModel
delegate: myDelegate

View File

@ -1,4 +1,5 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
@ -6,13 +7,13 @@ ListView {
height: 100
model: visualModel.parts.package
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: SingleRoleModel {

View File

@ -1,16 +1,17 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: VisualDataModel {
model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: SingleRoleModel {

View File

@ -1,17 +1,18 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: visualModel.parts.package
VisualDataModel {
DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: [

View File

@ -1,16 +1,17 @@
import QtQuick 2.0
import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: VisualDataModel {
model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: [

View File

@ -1,6 +1,7 @@
import QtQuick 2.0
import QtQml.Models 2.12
VisualDataModel {
DelegateModel {
function setRoot() {
rootIndex = modelIndex(0);
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -1213,7 +1213,7 @@ void tst_qquickvisualdatamodel::watchedRoles()
QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
QVERIFY(vdm);
// VisualDataModel doesn't initialize model data until the first item is requested.
// DelegateModel doesn't initialize model data until the first item is requested.
QQuickItem *item = qobject_cast<QQuickItem*>(vdm->object(0));
QVERIFY(item);
vdm->release(item);
@ -1456,22 +1456,22 @@ void tst_qquickvisualdatamodel::remove()
QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
}
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: index out of range");
evaluate<void>(visualModel, "items.remove(-8, 4)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: index out of range");
evaluate<void>(visualModel, "items.remove(12, 2)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: invalid count");
evaluate<void>(visualModel, "items.remove(5, 3)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: invalid count");
evaluate<void>(visualModel, "items.remove(5, -2)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
@ -1593,37 +1593,37 @@ void tst_qquickvisualdatamodel::move()
QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
}
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: invalid count");
evaluate<void>(visualModel, "items.move(5, 2, -2)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: from index out of range");
evaluate<void>(visualModel, "items.move(-6, 2, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: from index out of range");
evaluate<void>(visualModel, "items.move(15, 2, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: from index out of range");
evaluate<void>(visualModel, "items.move(11, 1, 3)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: to index out of range");
evaluate<void>(visualModel, "items.move(2, -5, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: to index out of range");
evaluate<void>(visualModel, "items.move(2, 14, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: to index out of range");
evaluate<void>(visualModel, "items.move(2, 11, 4)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
@ -1786,82 +1786,82 @@ void tst_qquickvisualdatamodel::groups()
static const bool sMember[] = { f, f, f, f, f, f, f, f, t, t, f, f };
VERIFY_GROUPS;
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: invalid count");
evaluate<void>(visualModel, "items.addGroups(11, -4, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: index out of range");
evaluate<void>(visualModel, "items.addGroups(-1, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: index out of range");
evaluate<void>(visualModel, "items.addGroups(14, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: invalid count");
evaluate<void>(visualModel, "items.addGroups(11, 5, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: invalid count");
evaluate<void>(visualModel, "items.setGroups(11, -4, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: index out of range");
evaluate<void>(visualModel, "items.setGroups(-1, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: index out of range");
evaluate<void>(visualModel, "items.setGroups(14, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: invalid count");
evaluate<void>(visualModel, "items.setGroups(11, 5, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: invalid count");
evaluate<void>(visualModel, "items.removeGroups(11, -4, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: index out of range");
evaluate<void>(visualModel, "items.removeGroups(-1, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: index out of range");
evaluate<void>(visualModel, "items.removeGroups(14, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: invalid count");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: invalid count");
evaluate<void>(visualModel, "items.removeGroups(11, 5, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
@ -2150,7 +2150,7 @@ void tst_qquickvisualdatamodel::get()
void tst_qquickvisualdatamodel::invalidGroups()
{
QUrl source = testFileUrl("groups-invalid.qml");
QTest::ignoreMessage(QtWarningMsg, (source.toString() + ":12:9: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("Group names must start with a lower case letter")).toUtf8());
QTest::ignoreMessage(QtWarningMsg, (source.toString() + ":13:9: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("Group names must start with a lower case letter")).toUtf8());
QQmlComponent component(&engine, source);
QScopedPointer<QObject> object(component.create());
@ -2331,35 +2331,35 @@ void tst_qquickvisualdatamodel::create()
// persistedItems.includeByDefault is true, so all items belong to persistedItems initially.
QVERIFY(delegate = findItem<QQuickItem>(contentItem, "delegate", 1));
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
// changing include by default doesn't remove persistance.
evaluate<void>(visualModel, "persistedItems.includeByDefault = false");
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
// removing from persistedItems does.
evaluate<void>(visualModel, "persistedItems.remove(0, 20)");
QCOMPARE(listview->count(), 20);
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
// Request an item instantiated by the view.
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(1)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 1));
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
evaluate<void>(delegate, "VisualDataModel.inPersistedItems = false");
evaluate<void>(delegate, "DelegateModel.inPersistedItems = false");
QCOMPARE(listview->count(), 20);
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
// Request an item not instantiated by the view.
QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 15));
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(15)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 15));
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
evaluate<void>(visualModel, "persistedItems.remove(0)");
@ -2371,28 +2371,28 @@ void tst_qquickvisualdatamodel::create()
QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 16));
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(16)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 16));
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
evaluate<void>(listview, "positionViewAtIndex(19, ListView.End)");
QCOMPARE(listview->count(), 20);
evaluate<void>(delegate, "VisualDataModel.groups = [\"items\"]");
evaluate<void>(delegate, "DelegateModel.groups = [\"items\"]");
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
// Request and release an item instantiated by the view, then scroll the view so it releases it.
QVERIFY(findItem<QQuickItem>(contentItem, "delegate", 17));
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(17)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 17));
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
evaluate<void>(visualModel, "items.removeGroups(17, \"persistedItems\")");
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
evaluate<void>(listview, "positionViewAtIndex(1, ListView.Beginning)");
QCOMPARE(listview->count(), 20);
@ -2407,7 +2407,7 @@ void tst_qquickvisualdatamodel::create()
evaluate<void>(listview, "positionViewAtIndex(19, ListView.End)");
QCOMPARE(listview->count(), 20);
QVERIFY(delegate = findItem<QQuickItem>(contentItem, "delegate", 18));
QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
evaluate<void>(listview, "positionViewAtIndex(1, ListView.Beginning)");
@ -2428,11 +2428,11 @@ void tst_qquickvisualdatamodel::create()
void tst_qquickvisualdatamodel::incompleteModel()
{
// VisualDataModel is first populated in componentComplete. Verify various functions are
// DelegateModel is first populated in componentComplete. Verify various functions are
// harmlessly ignored until then.
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0\n VisualDataModel {}", testFileUrl(""));
component.setData("import QtQuick 2.0\nimport QtQml.Models 2.2\nDelegateModel {}", testFileUrl(""));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
@ -2462,7 +2462,7 @@ void tst_qquickvisualdatamodel::incompleteModel()
QCOMPARE(itemsSpy.count(), 0);
QCOMPARE(persistedItemsSpy.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: get: index out of range");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: get: index out of range");
QVERIFY(evaluate<bool>(model, "items.get(0) === undefined"));
component.completeCreate();
@ -3113,16 +3113,16 @@ void tst_qquickvisualdatamodel::insert()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(i));
}
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), true);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), false);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), true);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), false);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), false);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), itemsIndex);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), visible || i <= index ? i : i - 1);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), selected && i > index ? 1 : 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), itemsIndex);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), visible || i <= index ? i : i - 1);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), selected && i > index ? 1 : 0);
} else if (inItems) {
get = QString("items.get(%1)").arg(index);
} else if (persisted) {
@ -3176,16 +3176,16 @@ void tst_qquickvisualdatamodel::insert()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(index));
}
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), inItems);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), visible);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), selected);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), true);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), inItems);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), visible);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), selected);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), true);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), 0);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), 0);
}
void tst_qquickvisualdatamodel::resolve_data()
@ -3577,16 +3577,16 @@ void tst_qquickvisualdatamodel::resolve()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(i));
}
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), true);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), false);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), true);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), false);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), false);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), itemsIndex);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), visible || i <= index ? i : i - 1);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), selected && i > index ? 1 : 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), itemsIndex);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), visible || i <= index ? i : i - 1);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), selected && i > index ? 1 : 0);
} else if (inItems) {
get = QString("items.get(%1)").arg(index);
} else if (persisted) {
@ -3640,16 +3640,16 @@ void tst_qquickvisualdatamodel::resolve()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(index));
}
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), inItems);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), visible);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), selected);
QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), inItems);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), visible);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), selected);
QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), false);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), 0);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), 0);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), index);
QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), 0);
}
void tst_qquickvisualdatamodel::warnings_data()
@ -3662,67 +3662,67 @@ void tst_qquickvisualdatamodel::warnings_data()
QTest::newRow("insert < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.insert(-2, {\"number\": \"eight\"})")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< 4;
QTest::newRow("insert > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.insert(8, {\"number\": \"eight\"})")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< 4;
QTest::newRow("create < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.create(-2, {\"number\": \"eight\"})")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< 4;
QTest::newRow("create > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.create(8, {\"number\": \"eight\"})")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< 4;
QTest::newRow("resolve from < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(-2, 3)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< 4;
QTest::newRow("resolve from > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(8, 3)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< 4;
QTest::newRow("resolve to < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, -2)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< 4;
QTest::newRow("resolve to > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, 8)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< 4;
QTest::newRow("resolve from invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(\"two\", 3)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index invalid"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from index invalid"))
<< 4;
QTest::newRow("resolve to invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, \"two\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index invalid"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to index invalid"))
<< 4;
QTest::newRow("resolve already resolved item")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, 2)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from is not an unresolved item"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from is not an unresolved item"))
<< 4;
QTest::newRow("resolve already resolved item")
@ -3730,193 +3730,193 @@ void tst_qquickvisualdatamodel::warnings_data()
<< QString("{ items.insert(0, {\"number\": \"eight\"});"
"items.insert(1, {\"number\": \"seven\"});"
"items.resolve(0, 1)}")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to is not a model item"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to is not a model item"))
<< 6;
QTest::newRow("remove index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(-2, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(4, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(9, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(\"nine\", 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid index"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: invalid index"))
<< 4;
QTest::newRow("remove count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(1, -2)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< 4;
QTest::newRow("remove index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(2, 4, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< 4;
QTest::newRow("addGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(-2, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(4, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(9, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(1, -2, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< 4;
QTest::newRow("addGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(2, 4, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< 4;
QTest::newRow("removeGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(-2, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(4, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(9, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(1, -2, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< 4;
QTest::newRow("removeGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(2, 4, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< 4;
QTest::newRow("setGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(-2, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(4, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(9, 1, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(1, -2, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< 4;
QTest::newRow("setGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(2, 4, \"selected\")")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< 4;
QTest::newRow("move from < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(-2, 1, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move from == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(4, 1, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move from > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(9, 1, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move invalid from")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(\"nine\", 1, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid from index"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: invalid from index"))
<< 4;
QTest::newRow("move to < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, -2, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move to == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 4, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move to > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 9, 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move invalid to")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, \"nine\", 1)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid to index"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: invalid to index"))
<< 4;
QTest::newRow("move count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 1, -2)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid count"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: invalid count"))
<< 4;
QTest::newRow("move from + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(2, 1, 4)")
<< ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
import QtQml.Models 2.12
Item {
id: repeaterelementtest
@ -48,7 +49,7 @@ Item {
}
VisualItemModel {
ObjectModel {
id: repeatermodel
Rectangle { color: "blue"; height: 40; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true
Text { text: "I am Thing 1"; anchors.centerIn: parent } }

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
height: 360; width: 640
@ -105,7 +106,7 @@ Rectangle {
anchors.right: parent.right
Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
VisualItemModel {
ObjectModel {
id: controlsmodel
ControlView {
id: textvalue

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.1
import QtQml.Models 2.12
Rectangle {
height: 360; width: 640
@ -102,7 +103,7 @@ Rectangle {
anchors.right: parent.right
Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
VisualItemModel {
ObjectModel {
id: controlsmodel
ControlView {
id: textvalue

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
import QtQml.Models 2.12
Rectangle {
height: 360; width: 640
@ -148,7 +149,7 @@ Rectangle {
anchors.right: parent.right
Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
VisualItemModel {
ObjectModel {
id: controlsmodel
ControlView {
id: textvalue