aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2017-04-26 09:40:37 +0200
committerMichael BrĂ¼ning <michael.bruning@qt.io>2017-04-27 10:29:21 +0000
commit0757777f196647e04c6813f0347179437fdc4812 (patch)
tree1af0e53730d4a02bd2c35dac8f9ce44ab2f6d480 /src/quick/items
parent2cb540b4687b198e67c0bc6f176b7e94755ff7fb (diff)
Add a method to query the scene graph backend
Since 5.8, it has been possible to set the scene graph backend using QQuickWindow::setSceneGraphBackend instead of using the environment variables. This caused some trouble with modules that need to know which backend is used and relied on the environment variables or command line options for getting this information. One example of such a module is Qt WebEngine, which crashed because it ended up trying to use OpenGL resources with the Qt Quick scenegraph software backend. Task-number: QTBUG-60232 Change-Id: Ia7c4860b16a9ce6fe9af73dfe5a5d2d19ebf5bfd Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickwindow.cpp14
-rw-r--r--src/quick/items/qquickwindow.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index a8606ff1b6..8e78586697 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -4564,6 +4564,20 @@ void QQuickWindow::setSceneGraphBackend(const QString &backend)
}
/*!
+ Returns the requested Qt Quick scenegraph \a backend.
+
+ \note The return value of this function may still be outdated by
+ subsequent calls to setSceneGraphBackend() until the first QQuickWindow in the
+ application has been constructed.
+
+ \since 5.9
+ */
+QString QQuickWindow::sceneGraphBackend()
+{
+ return QSGContext::backend();
+}
+
+/*!
Creates a simple rectangle node. When the scenegraph is not initialized, the return value is null.
This is cross-backend alternative to constructing a QSGSimpleRectNode directly.
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 27a73988ae..9c3e7277bc 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -162,6 +162,7 @@ public:
static void setSceneGraphBackend(QSGRendererInterface::GraphicsApi api);
static void setSceneGraphBackend(const QString &backend);
+ static QString sceneGraphBackend();
QSGRectangleNode *createRectangleNode() const;
QSGImageNode *createImageNode() const;