aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-08-09 16:20:22 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-08-09 16:20:22 +0200
commit36990a732eab2dc16bee89715662f6d3d8b3a0cd (patch)
treed835ba67426e12e51dc1028e8ebac9087a3d43b0 /src/qml/qml/qqmlengine.cpp
parentcb37a1d0c3fce7951f5d7f1fb4a04f90e038f01b (diff)
parentd1b72c98b4e617530bfb23c3a5b7ebc68c15c089 (diff)
Merge remote-tracking branch 'origin/dev' into wip/qt6
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 43c312812c..8bf660d2ec 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -2454,17 +2454,20 @@ QJSValue QQmlEnginePrivate::singletonInstance<QJSValue>(const QQmlType &type)
} else if (siinfo->qobjectCallback) {
QObject *o = siinfo->qobjectCallback(q, q);
if (!o) {
- qFatal("qmlRegisterSingletonType(): \"%s\" is not available because the callback function returns a null pointer.",
- qPrintable(QString::fromUtf8(type.typeName())));
+ QQmlError error;
+ error.setMessageType(QtMsgType::QtCriticalMsg);
+ error.setDescription(QString::asprintf("qmlRegisterSingletonType(): \"%s\" is not available because the callback function returns a null pointer.",
+ qPrintable(QString::fromUtf8(type.typeName()))));
+ warning(error);
+ } else {
+ // if this object can use a property cache, create it now
+ QQmlData::ensurePropertyCache(q, o);
}
- // if this object can use a property cache, create it now
- QQmlData::ensurePropertyCache(q, o);
// even though the object is defined in C++, qmlContext(obj) and qmlEngine(obj)
// should behave identically to QML singleton types.
q->setContextForObject(o, new QQmlContext(q->rootContext(), q));
value = q->newQObject(o);
singletonInstances.insert(type, value);
-
} else if (!siinfo->url.isEmpty()) {
QQmlComponent component(q, siinfo->url, QQmlComponent::PreferSynchronous);
QObject *o = component.beginCreate(q->rootContext());