From 78a5add79497300802c2152b5bf561b6bef305f1 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 21 Dec 2017 11:03:53 -0600 Subject: Remove extra addref The code was previously updated to use QQmlRefPointer, so we shouldn't explicitly addref. This allows more components to be correctly trimmed when needed. Change-Id: I15a961cfc456eeab5c791c8a282cc7e2852912cb Reviewed-by: Lars Knoll --- src/qml/types/qqmldelegatemodel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/qml/types') diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 9dd82494ca..2f8a70d63b 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -1969,7 +1969,6 @@ void QQmlDelegateModelItem::incubateObject( QQmlComponentPrivate *componentPriv = QQmlComponentPrivate::get(component); incubatorPriv->compilationUnit = componentPriv->compilationUnit; - incubatorPriv->compilationUnit->addref(); incubatorPriv->enginePriv = enginePriv; incubatorPriv->creator.reset(new QQmlObjectCreator(context, componentPriv->compilationUnit, componentPriv->creationContext)); incubatorPriv->subComponentToCreate = componentPriv->start; -- cgit v1.2.3 From 52874a0e6f739ce410c8401e19b0a9ef6d02cabf Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 15 Jan 2018 11:30:26 +0100 Subject: Optimizations for Repeater::clear() and ~QQmlItem() QQmlRepeater::clear() had quadratic complexity in the number of items, because the items where removed from the back. Fix this by searching the cache from the back as well as searching for child items to remove from the back. Change-Id: I92e491a8abf47cee9d382ef15cd2471f722fa6dd Reviewed-by: Simon Hausmann --- src/qml/types/qqmldelegatemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/types') diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 2f8a70d63b..f1b5759a7d 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -864,7 +864,7 @@ void QQmlDelegateModelPrivate::releaseIncubator(QQDMIncubationTask *incubationTa void QQmlDelegateModelPrivate::removeCacheItem(QQmlDelegateModelItem *cacheItem) { - int cidx = m_cache.indexOf(cacheItem); + int cidx = m_cache.lastIndexOf(cacheItem); if (cidx >= 0) { m_compositor.clearFlags(Compositor::Cache, cidx, 1, Compositor::CacheFlag); m_cache.removeAt(cidx); -- cgit v1.2.3 From 706a6647db695cdeb854ef1bf956ded56b498f78 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Thu, 18 Jan 2018 14:38:19 +0100 Subject: Fix QQmlDelegateModel::object documentation It is talking about item() but such a method doesn't exist anymore. Change-Id: I1935d8b9e88b27a9db1122545a2a82a42d827671 Reviewed-by: Michael Brasser --- src/qml/types/qqmldelegatemodel.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/qml/types') diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index f1b5759a7d..2badef4268 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -1019,11 +1019,11 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ /* If asynchronous is true or the component is being loaded asynchronously due - to an ancestor being loaded asynchronously, item() may return 0. In this - case createdItem() will be emitted when the item is available. The item - at this stage does not have any references, so item() must be called again - to ensure a reference is held. Any call to item() which returns a valid item - must be matched by a call to release() in order to destroy the item. + to an ancestor being loaded asynchronously, object() may return 0. In this + case createdItem() will be emitted when the object is available. The object + at this stage does not have any references, so object() must be called again + to ensure a reference is held. Any call to object() which returns a valid object + must be matched by a call to release() in order to destroy the object. */ QObject *QQmlDelegateModel::object(int index, QQmlIncubator::IncubationMode incubationMode) { -- cgit v1.2.3