aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index ca9c1d8e52..bb740962f6 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -494,7 +494,8 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data)
const char *elementName = (type.structVersion > 1 && type.forceAnonymous)
? nullptr
: classElementName(type.classInfoMetaObject);
- const bool creatable = (elementName != nullptr)
+ const bool isValueType = !(type.typeId.flags() & QMetaType::PointerToQObject);
+ const bool creatable = (elementName != nullptr || isValueType)
&& boolClassInfo(type.classInfoMetaObject, "QML.Creatable", true);
QString noCreateReason;
@@ -505,7 +506,7 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data)
classInfo(type.classInfoMetaObject, "QML.UncreatableReason"));
if (noCreateReason.isEmpty())
noCreateReason = QLatin1String("Type cannot be created in QML.");
- } else if (!(type.typeId.flags() & QMetaType::PointerToQObject)) {
+ } else if (isValueType) {
const char *method = classInfo(type.classInfoMetaObject, "QML.CreationMethod");
if (qstrcmp(method, "structured") == 0)
creationMethod = ValueTypeCreationMethod::Structured;