From f580f4ce858a332e62948c1c5372995e9a576452 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 14 Apr 2014 12:44:34 +0200 Subject: Ensure that styleData.row is initialized in delegates While we specifically documented that you should not depend on the value being correct in onCompleted for 5.3, it is not optimal that the initial value is consistently set to 0 and later changed to it's appropriate value. This patch ensures that delegates are not instantiated until after the model model and row values have been fully initialized. Task-number: QTBUG-38307 Change-Id: Ib3300539a0283c997ab8b808fb229d3f22ed6324 Reviewed-by: J-P Nurmi --- src/controls/TableView.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/controls/TableView.qml') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 84046138..85ff4019 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -861,7 +861,7 @@ ScrollView { Loader { id: rowstyle // row delegate - sourceComponent: root.rowDelegate + sourceComponent: rowitem.itemModel !== undefined ? root.rowDelegate : null // Row fills the view width regardless of item size // But scrollbar should not adjust to it height: item ? item.height : 16 @@ -891,7 +891,8 @@ ScrollView { width: columnItem.width height: parent ? parent.height : 0 visible: columnItem.visible - sourceComponent: columnItem.delegate ? columnItem.delegate : itemDelegate + sourceComponent: rowitem.itemModel !== undefined ? // delays construction until model is initialized + (columnItem.delegate ? columnItem.delegate : itemDelegate) : null // these properties are exposed to the item delegate readonly property var model: itemModel -- cgit v1.2.1