aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-04-29 13:24:58 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2020-05-06 10:44:58 +0200
commit22f9e5fb1ed643f284f50b9417bdbafdfb20566b (patch)
tree9c2616522ca98534e2ceb6e4f13a9ffe5c622b93 /src/qml/qml/qqml.cpp
parent1250d8b5b95eecac767a23563717e53faa5d3b8a (diff)
Add a default message to QML_UNCREATABLE
[ChangeLog][QML][Feature] Add a default message to QML_UNCREATABLE when proving an empty string as a reason Fixes: QTBUG-83842 Change-Id: Ifd2044fa6c56c3a382d451ec47d5f92a1ac16b81 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 28b48e2eee..a57daf78d2 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -202,9 +202,14 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data)
const bool creatable = (elementName != nullptr)
&& boolClassInfo(type.classInfoMetaObject, "QML.Creatable", true);
- const QString noCreateReason = creatable
- ? QString()
- : QString::fromUtf8(classInfo(type.classInfoMetaObject, "QML.UncreatableReason"));
+ QString noCreateReason;
+
+ if (!creatable) {
+ noCreateReason = QString::fromUtf8(classInfo(type.classInfoMetaObject, "QML.UncreatableReason"));
+ if (noCreateReason.isEmpty())
+ noCreateReason = QLatin1String("Type cannot be created in QML.");
+ }
+
RegisterType revisionRegistration = {
0,
type.typeId,