diff options
author | Sami Nurmenniemi <sami.nurmenniemi@qt.io> | 2017-06-14 14:44:52 +0300 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-06-16 07:38:23 +0000 |
commit | 158ba2d958a5099a381661abf775db4ff3ce75e9 (patch) | |
tree | e4df29df1cf93cd465601f9421bc607d5569f80f | |
parent | 9f3aefb086c5f9d6b9dd192689bdd473da07186a (diff) |
Move default renderer selection from build to run time
Previously software renderer was used as default only if OpenGL
support was not compiled in. That does not work for example when
using offscreen or minimal platforms with Qt that has OpenGL
support compiled in.
[ChangeLog][QtQuick] Selecting software as default renderer moved
from build time to run time
Task-number: QTBUG-60268
Change-Id: I4d1de09d8402af9c2b2feb36f8cfa92acd160243
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | src/quick/scenegraph/qsgcontextplugin.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index b8b5141957..bd311d3b46 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -49,6 +49,9 @@ #include <QtQuick/private/qsgdefaultcontext_p.h> #endif +#include <QtGui/private/qguiapplication_p.h> +#include <QtGui/qpa/qplatformintegration.h> + QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_INFO) @@ -128,12 +131,12 @@ QSGAdaptationBackendData *contextFactory() if (requestedBackend.isEmpty() && qEnvironmentVariableIsSet("QT_QUICK_BACKEND")) requestedBackend = QString::fromLocal8Bit(qgetenv("QT_QUICK_BACKEND")); -#if !QT_CONFIG(opengl) - // If this is a build without OpenGL, and no backend has been set + // If this platform does not support OpenGL, and no backend has been set // default to the software renderer - if (requestedBackend.isEmpty()) + if (requestedBackend.isEmpty() + && !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { requestedBackend = QString::fromLocal8Bit("software"); -#endif + } if (!requestedBackend.isEmpty()) { qCDebug(QSG_LOG_INFO) << "Loading backend" << requestedBackend; |