diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-02-02 22:17:41 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2015-02-23 12:43:06 +0000 |
commit | 59f6a78b5fddf71f2c98e8b67e093b7e8d1cb3d3 (patch) | |
tree | bc15cfb2c2ebe45af2958e12358b7d565d4e8fdc /src/quickwidgets/qquickwidget.cpp | |
parent | 4db31cbd4e29cf5387f4332537f8ea9e0e9f62ae (diff) |
QQuickView/QQuickWidget: Report an error if rootObject ends up null.
This can happen when trying to use a non-QQuickItem item as the root item in a
QQuickView, for instance, a Window or ApplicationWindow item.
This generates a warning (correctly), but does not set an error state on the
view, so automated tooling and the like does not know that the scene was not
successfully loaded.
Change-Id: I1dc4191ef07187e9b1929995aedb01c155b0957c
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/quickwidgets/qquickwidget.cpp')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 3bdf0bfc0a..f5b2122b60 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -530,6 +530,9 @@ QQuickWidget::Status QQuickWidget::status() const if (!d->component) return QQuickWidget::Null; + if (d->component->status() == QQmlComponent::Ready && !d->root) + return QQuickWidget::Error; + return QQuickWidget::Status(d->component->status()); } @@ -551,6 +554,10 @@ QList<QQmlError> QQuickWidget::errors() const QQmlError error; error.setDescription(QLatin1String("QQuickWidget: invalid qml engine.")); errs << error; + } else if (d->component->status() == QQmlComponent::Ready && !d->root) { + QQmlError error; + error.setDescription(QLatin1String("QQuickWidget: invalid root object.")); + errs << error; } return errs; |