diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2017-04-26 09:40:37 +0200 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2017-04-27 10:29:21 +0000 |
commit | 0757777f196647e04c6813f0347179437fdc4812 (patch) | |
tree | 1af0e53730d4a02bd2c35dac8f9ce44ab2f6d480 /src/quick/scenegraph | |
parent | 2cb540b4687b198e67c0bc6f176b7e94755ff7fb (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/scenegraph')
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontextplugin.cpp | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 2f5d5790ee..1c4cd0ce90 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -145,6 +145,7 @@ public: static QSGRenderLoop *createWindowManager(); static void setBackend(const QString &backend); + static QString backend(); }; class Q_QUICK_PRIVATE_EXPORT QSGRenderContext : public QObject diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 46c2a1dbd9..b8b5141957 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -232,6 +232,15 @@ void QSGContext::setBackend(const QString &backend) backendData->quickWindowBackendRequest = backend; } +QString QSGContext::backend() +{ + QSGAdaptationBackendData *backendData = qsg_adaptation_data(); + if (backendData->tried) + return backendData->name; + + return backendData->quickWindowBackendRequest; +} + QT_END_NAMESPACE #include "moc_qsgcontextplugin_p.cpp" |