aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertyvalidator.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-03-22 14:01:13 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-03-24 14:33:05 +0100
commit7dba80af8715297a7a946e11c1961c6268897171 (patch)
treef7c3d973371522b0eb656955debef9ae8f1735f2 /src/qml/qml/qqmlpropertyvalidator.cpp
parent185760fa44f5b62f1ed3f10a458f4bc38072768f (diff)
QtQml: Uncruftify QQmlImports
QQmlImports is a refcounted datastructure. Therefore, use QQmlRefPointer for it, and avoid all the pointless indirection. Also, make the flags type safe and document the mutability of the import namespaces. Change-Id: I54a0db42b2b7cdfb516e9f90c2264edfa800bfe6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertyvalidator.cpp')
-rw-r--r--src/qml/qml/qqmlpropertyvalidator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlpropertyvalidator.cpp b/src/qml/qml/qqmlpropertyvalidator.cpp
index 1bdcfc220c..06a6acc229 100644
--- a/src/qml/qml/qqmlpropertyvalidator.cpp
+++ b/src/qml/qml/qqmlpropertyvalidator.cpp
@@ -63,7 +63,9 @@ QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(HANDLE_PRIMITIVE);
}
}
-QQmlPropertyValidator::QQmlPropertyValidator(QQmlEnginePrivate *enginePrivate, const QQmlImports &imports, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit)
+QQmlPropertyValidator::QQmlPropertyValidator(
+ QQmlEnginePrivate *enginePrivate, const QQmlImports *imports,
+ const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit)
: enginePrivate(enginePrivate)
, compilationUnit(compilationUnit)
, imports(imports)
@@ -223,7 +225,8 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject(
if (name.constData()->isUpper() && !binding->isAttachedProperty()) {
QQmlType type;
QQmlImportNamespace *typeNamespace = nullptr;
- imports.resolveType(stringAt(binding->propertyNameIndex), &type, nullptr, &typeNamespace);
+ imports->resolveType(
+ stringAt(binding->propertyNameIndex), &type, nullptr, &typeNamespace);
if (typeNamespace)
return recordError(binding->location, tr("Invalid use of namespace"));
return recordError(binding->location, tr("Invalid attached object assignment"));
@@ -363,7 +366,7 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject(
customParser->clearErrors();
customParser->validator = this;
customParser->engine = enginePrivate;
- customParser->imports = &imports;
+ customParser->imports = imports;
customParser->verifyBindings(compilationUnit, customBindings);
customParser->validator = nullptr;
customParser->engine = nullptr;