aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-07-18 17:12:14 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-07-19 09:05:30 +0000
commitb5d7be57ccb8ca60590ed30d04271e76acc84029 (patch)
tree2bea23bfdd86ba494f36aaa481cdbd14a0583d35 /tests
parent379ba8640a9cf7e43e848eb07c11989f0f4f3ddd (diff)
QQuickTableView: set delegate parent early-on
Set the parent before bindings are evaluated. Change-Id: I370524fe32c66699bd73aafeac55c58667b4dff1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicktableview/data/plaintableview.qml5
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp15
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktableview/data/plaintableview.qml b/tests/auto/quick/qquicktableview/data/plaintableview.qml
index a073941faa..36c28525d5 100644
--- a/tests/auto/quick/qquicktableview/data/plaintableview.qml
+++ b/tests/auto/quick/qquicktableview/data/plaintableview.qml
@@ -49,6 +49,7 @@ Item {
property real delegateWidth: 100
property real delegateHeight: 50
property Component delegate: tableViewDelegate
+ property bool delegateParentSetBeforeCompleted: false
TableView {
id: tableView
@@ -74,6 +75,10 @@ Item {
anchors.centerIn: parent
text: modelData
}
+
+ Component.onCompleted: {
+ delegateParentSetBeforeCompleted = parent != null;
+ }
}
}
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
index 34d8dc8d55..9ba8d8a394 100644
--- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
+++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
@@ -105,6 +105,7 @@ private slots:
void checkInitialAttachedProperties_data();
void checkInitialAttachedProperties();
void checkSpacingValues();
+ void checkDelegateParent();
void flick_data();
void flick();
void flickOvershoot_data();
@@ -732,6 +733,20 @@ void tst_QQuickTableView::checkSpacingValues()
QCOMPARE(tableView->columnSpacing(), 12);
}
+void tst_QQuickTableView::checkDelegateParent()
+{
+ // Check that TableView sets the delegate parent before
+ // bindings are evaluated, so that the app can bind to it.
+ LOAD_TABLEVIEW("plaintableview.qml");
+
+ auto model = TestModelAsVariant(100, 100);
+ tableView->setModel(model);
+
+ WAIT_UNTIL_POLISHED;
+
+ QVERIFY(view->rootObject()->property("delegateParentSetBeforeCompleted").toBool());
+}
+
void tst_QQuickTableView::flick_data()
{
QTest::addColumn<QSizeF>("spacing");