diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-04-29 12:33:16 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-05-03 16:38:09 +0000 |
commit | 605d6194c9d481a50fbc927a0094446690f651a6 (patch) | |
tree | e16e4257457494d9c0d0700a791cfa1033f36655 /src/qml/types | |
parent | aae18aa05719c4b750905f467f42002f4cea1516 (diff) |
QQmlComponent: Move incubateObject from QQmlDelegateModel to QQmlComponentPrivate
This feels like a slightly tidier encapsulation.
Change-Id: Iff6c05e1fe7fbc6bb1ec58a7ea42d32ee03187df
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 28 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p_p.h | 5 |
2 files changed, 3 insertions, 30 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 8f4b9cd519..9620df6af9 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -988,7 +988,9 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, bo } } - cacheItem->incubateObject( + QQmlComponentPrivate *cp = QQmlComponentPrivate::get(m_delegate); + cp->incubateObject( + cacheItem->incubationTask, m_delegate, m_context->engine(), ctxt, @@ -1935,30 +1937,6 @@ void QQmlDelegateModelItem::Dispose() delete this; } -/* - This is essentially a copy of QQmlComponent::create(); except it takes the QQmlContextData - arguments instead of QQmlContext which means we don't have to construct the rather weighty - wrapper class for every delegate item. -*/ -void QQmlDelegateModelItem::incubateObject( - QQmlComponent *component, - QQmlEngine *engine, - QQmlContextData *context, - QQmlContextData *forContext) -{ - QQmlIncubatorPrivate *incubatorPriv = QQmlIncubatorPrivate::get(incubationTask); - QQmlEnginePrivate *enginePriv = QQmlEnginePrivate::get(engine); - 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; - - enginePriv->incubate(*incubationTask, forContext); -} - void QQmlDelegateModelItem::destroyObject() { Q_ASSERT(object); diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index cb4a1f79ba..4ebfd9b938 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -112,11 +112,6 @@ public: QObject *modelObject() { return this; } - void incubateObject( - QQmlComponent *component, - QQmlEngine *engine, - QQmlContextData *context, - QQmlContextData *forContext); void destroyObject(); static QQmlDelegateModelItem *dataForObject(QObject *object); |