aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcomponent_p.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-10-31 12:15:22 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2022-11-10 15:00:11 +0100
commitf086d452503a9e3703484921939593f7ff35cd47 (patch)
tree1d8709eee18858e507fe3a51911616bbd424670b /src/qml/qml/qqmlcomponent_p.h
parent00af995d5c8d288f8add068eb1a9562d96f11fa9 (diff)
QQmlComponent: Remove required components accessor
Instead, access it directly via state. Also, introduce a hasUnsetRequiredProperties helper function to simplify a few checks, and a addPendingRequiredProperty heper function to indicate places where we actually insert new entries to the list. This is a preparation to further refactor the handling of required properties in QQmlComponent. Change-Id: I25f5ef45be0b3508cf5b0f82a666d33610d5810d Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlcomponent_p.h')
-rw-r--r--src/qml/qml/qqmlcomponent_p.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h
index ea926577f4..e61fd1ca69 100644
--- a/src/qml/qml/qqmlcomponent_p.h
+++ b/src/qml/qml/qqmlcomponent_p.h
@@ -68,7 +68,6 @@ public:
qreal progress;
int start;
- RequiredProperties& requiredProperties();
bool hadTopLevelRequiredProperties() const;
// TODO: merge compilation unit and type
QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit;
@@ -96,6 +95,10 @@ public:
QList<AnnotatedQmlError> errors;
bool completePending = false;
+ /*!
+ \internal A list of pending required properties that need
+ to be set in order for object construction to be successful.
+ */
RequiredProperties &requiredProperties() {
if (hasCreator())
return m_creator->requiredProperties();
@@ -103,6 +106,20 @@ public:
return m_requiredProperties;
}
+ void addPendingRequiredProperty(const QQmlPropertyData *propData, const RequiredPropertyInfo &info)
+ {
+ requiredProperties().insert(propData, info);
+ }
+
+ bool hasUnsetRequiredProperties() const {
+ return !const_cast<ConstructionState *>(this)->requiredProperties().isEmpty();
+ }
+
+ void clearRequiredProperties()
+ {
+ requiredProperties().clear();
+ }
+
void appendErrors(const QList<QQmlError> &qmlErrors)
{