diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-10-31 14:51:13 +0100 |
|---|---|---|
| committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-11-10 15:00:11 +0100 |
| commit | 7b67d4061974de01eb5387199fe18e67a400545f (patch) | |
| tree | 66231ec93d5d9a08b90c86313724c04c44c04e31 /src/qmlmodels/qqmltableinstancemodel.cpp | |
| parent | f086d452503a9e3703484921939593f7ff35cd47 (diff) | |
Required properties: Use pointers instead of references
This allows for a more natural handling of the case where there are no
required properties, and will enable further refactoring of
ConstructionState.
Unfortunately, we lack a way to mark pointers as always non-null in Qt,
else we could mark all required property pointers originating from
QQmlObjectCreatorSharedState as such.
Change-Id: Icaccb27654130fb57daf924bb44a70a5cf114fed
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qmlmodels/qqmltableinstancemodel.cpp')
| -rw-r--r-- | src/qmlmodels/qqmltableinstancemodel.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qmlmodels/qqmltableinstancemodel.cpp b/src/qmlmodels/qqmltableinstancemodel.cpp index 1c14427b90..e4fcae2a44 100644 --- a/src/qmlmodels/qqmltableinstancemodel.cpp +++ b/src/qmlmodels/qqmltableinstancemodel.cpp @@ -397,8 +397,8 @@ bool QQmlTableInstanceModel::setRequiredProperty(int index, const QString &name, bool wasInRequired = false; const auto task = QQmlIncubatorPrivate::get(modelItem->incubationTask); - RequiredProperties &props = task->requiredProperties(); - if (props.empty()) + RequiredProperties *props = task->requiredProperties(); + if (props->empty()) return false; QQmlProperty componentProp = QQmlComponentPrivate::removePropertyFromRequired( @@ -492,7 +492,7 @@ void QQmlTableInstanceModelIncubationTask::setInitialState(QObject *object) modelItemToIncubate->object = object; emit tableInstanceModel->initItem(modelItemToIncubate->index, object); - if (!QQmlIncubatorPrivate::get(this)->requiredProperties().empty()) { + if (!QQmlIncubatorPrivate::get(this)->requiredProperties()->empty()) { modelItemToIncubate->object = nullptr; object->deleteLater(); } |
