aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2015-02-02 22:24:12 +0100
committerRobin Burchell <robin.burchell@viroteck.net>2015-02-23 12:43:08 +0000
commitc77d187b81dad91ba1d8fec35956a9822abe059e (patch)
treea5da3786a78b4d15908f46ed23e90e249e058865
parent59f6a78b5fddf71f2c98e8b67e093b7e8d1cb3d3 (diff)
QQuickView/QQuickWidget: Improve diagnostics for using a QWindow as a base item in a scene.
The current message is rather confusing, as it was aimed at users porting from QtQuick 1 -- but it is perfectly possible to get a non-QQuickItem root in a QQuickView scene right now with QtQuick 2 only. Change-Id: Ibd800f8a817c874af5eaa1746567ee289988fd01 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
-rw-r--r--src/quick/items/qquickview.cpp4
-rw-r--r--src/quickwidgets/qquickwidget.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index a463f0a554..9bc512b80b 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -508,6 +508,10 @@ void QQuickViewPrivate::setRootObject(QObject *obj)
if (QQuickItem *sgItem = qobject_cast<QQuickItem *>(obj)) {
root = sgItem;
sgItem->setParentItem(q->QQuickWindow::contentItem());
+ } else if (qobject_cast<QWindow *>(obj)) {
+ qWarning() << "QQuickView does not support using windows as a root item." << endl
+ << endl
+ << "If you wish to create your root window from QML, consider using QQmlApplicationEngine instead." << endl;
} else {
qWarning() << "QQuickView only supports loading of root objects that derive from QQuickItem." << endl
<< endl
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index f5b2122b60..4dae6e6aef 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -826,6 +826,10 @@ void QQuickWidgetPrivate::setRootObject(QObject *obj)
if (QQuickItem *sgItem = qobject_cast<QQuickItem *>(obj)) {
root = sgItem;
sgItem->setParentItem(offscreenWindow->contentItem());
+ } else if (qobject_cast<QWindow *>(obj)) {
+ qWarning() << "QQuickWidget does not support using windows as a root item." << endl
+ << endl
+ << "If you wish to create your root window from QML, consider using QQmlApplicationEngine instead." << endl;
} else {
qWarning() << "QQuickWidget only supports loading of root objects that derive from QQuickItem." << endl
<< endl