diff options
Diffstat (limited to 'src/qml/types/qqmltableinstancemodel.cpp')
-rw-r--r-- | src/qml/types/qqmltableinstancemodel.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/types/qqmltableinstancemodel.cpp b/src/qml/types/qqmltableinstancemodel.cpp index 33d13e3bad..1054158dc8 100644 --- a/src/qml/types/qqmltableinstancemodel.cpp +++ b/src/qml/types/qqmltableinstancemodel.cpp @@ -109,19 +109,19 @@ QQmlTableInstanceModel::~QQmlTableInstanceModel() QQmlComponent *QQmlTableInstanceModel::resolveDelegate(int index) { - QQmlComponent *delegate = nullptr; if (m_delegateChooser) { const int row = m_adaptorModel.rowAt(index); const int column = m_adaptorModel.columnAt(index); + QQmlComponent *delegate = nullptr; QQmlAbstractDelegateComponent *chooser = m_delegateChooser; do { delegate = chooser->delegate(&m_adaptorModel, row, column); chooser = qobject_cast<QQmlAbstractDelegateComponent *>(delegate); } while (chooser); + return delegate; } - if (!delegate) - delegate = m_delegate; - return delegate; + + return m_delegate; } QQmlDelegateModelItem *QQmlTableInstanceModel::resolveModelItem(int index) @@ -132,6 +132,8 @@ QQmlDelegateModelItem *QQmlTableInstanceModel::resolveModelItem(int index) return modelItem; QQmlComponent *delegate = resolveDelegate(index); + if (!delegate) + return nullptr; // Check if the pool contains an item that can be reused modelItem = takeFromReusableItemsPool(delegate); |