aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-05 01:00:07 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-12-05 10:09:17 +0100
commit88490da44e8afa0f4d03ca79bcc928a14412ef99 (patch)
tree41b40fe0f36c5ed49d0b8a2ce54421eb4dfbfd3b /tests/auto/quick/qquicktableview/data/replaceModelTableView.qml
parent6ad3445f1e159d9beea936b66d267dcaacdc5d6c (diff)
parente2af7c3b37095e601a84cc52de69a99af8e5d3a2 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: tests/auto/quick/qquicklistview/tst_qquicklistview.cpp tests/auto/quick/qquicktableview/tst_qquicktableview.cpp Change-Id: Ib46bc1c717cf524eea2fb3d876810c8d55747c91
Diffstat (limited to 'tests/auto/quick/qquicktableview/data/replaceModelTableView.qml')
-rw-r--r--tests/auto/quick/qquicktableview/data/replaceModelTableView.qml63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml b/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml
new file mode 100644
index 0000000000..2b17e055a7
--- /dev/null
+++ b/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml
@@ -0,0 +1,63 @@
+import QtQuick 2.14
+import QtQml.Models 2.14
+
+Item {
+ id: root
+ visible: true
+ width: 640
+ height: 480
+
+ property alias tableView: tv
+
+ ObjectModel {
+ id: om
+ Rectangle { height: 30; width: 80; color: "red" }
+ Rectangle { height: 30; width: 80; color: "green" }
+ Rectangle { height: 30; width: 80; color: "blue" }
+ }
+
+ ListModel {
+ id: lm
+ ListElement { name: "1" }
+ ListElement { name: "44"}
+ }
+
+ DelegateModel {
+ id: dm
+ model: ListModel {
+ ListElement { name: "Apple" }
+ ListElement { name: "Orange" }
+ }
+ delegate: Rectangle {
+ height: 25
+ width: 100
+ Text { text: "Name: " + name}
+ }
+ }
+ TableView {
+ id: tv
+ visible: true
+ anchors.fill: parent
+ property int modelId: 0
+
+ model: {
+ switch (modelId) {
+ case 0: return lm;
+ case 1: return om;
+ case 2: return dm;
+ default: return null;
+ }
+ }
+
+ delegate: Rectangle {
+ id: dlg
+ implicitWidth: 40
+ implicitHeight: 20
+ color: "red"
+ Text {
+ text: qsTr("name: " + name)
+ }
+ border.color: "green"
+ }
+ }
+}