diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2014-04-14 12:44:34 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-15 11:15:56 +0200 |
commit | f580f4ce858a332e62948c1c5372995e9a576452 (patch) | |
tree | f5b633ce0a4f68c56f762e5d80075434e96e1f20 /src/controls/TableView.qml | |
parent | 53fca456b2d5c4d290592846c0a14242ac218e1d (diff) | |
download | qtquickcontrols-f580f4ce858a332e62948c1c5372995e9a576452.tar.gz |
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 <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/TableView.qml')
-rw-r--r-- | src/controls/TableView.qml | 5 |
1 files changed, 3 insertions, 2 deletions
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 |