Commit 8a0f0553 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

TableView: Don't unset the delegate loader source component


Once we've loaded the delegate, we want to keep it. Constantly deleting
and recreating items is rather wasteful.

The items could already be moved to a different location before, so
keeping them around when the item is completely disabled doesn't make
much of a difference. We do retain the behavior of only instantiating
the delegate once we add it to the table, though.

Change-Id: Ic3cd016bc6990f0a9695b5aeb0d1de3aad0f4ca1
Task-number: QTBUG-62809
Reviewed-by: default avatarTor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: default avatarJ-P Nurmi <jpnurmi@qt.io>
Reviewed-by: default avatarLouis du Verdier <louis.du.verdier@free.fr>
Showing with 4 additions and 1 deletion
......@@ -65,7 +65,9 @@ Loader {
width: __column ? __column.width : 0
height: parent ? parent.height : 0
visible: __column ? __column.visible : false
sourceComponent: __model === undefined || styleData.row === -1 ? null
property bool isValid: false
sourceComponent: (__model === undefined || !isValid) ? null
: __column && __column.delegate ? __column.delegate : __itemDelegate
// All these properties are internal
......@@ -95,5 +97,6 @@ Loader {
readonly property var value: model && model.hasOwnProperty(role) ? model[role] // Qml ListModel and QAbstractItemModel
: modelData && modelData.hasOwnProperty(role) ? modelData[role] // QObjectList / QObject
: modelData != undefined ? modelData : "" // Models without role
onRowChanged: if (row !== -1) itemDelegateLoader.isValid = true
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment