diff options
-rw-r--r-- | src/plugins/platforms/windows/qwindowsintegration.cpp | 17 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsopengltester.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsopengltester.h | 4 |
3 files changed, 21 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 797a96cda7..6b50ebe8a1 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -338,11 +338,18 @@ QWindowsWindow *QWindowsIntegration::createPlatformWindowHelper(QWindow *window, QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate() { #if defined(QT_OPENGL_DYNAMIC) + const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(); + QWindowsOpenGLTester::Renderer requestedRenderer = QWindowsOpenGLTester::requestedRenderer(); switch (requestedRenderer) { case QWindowsOpenGLTester::DesktopGl: - if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) + if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) { + if ((supportedRenderers & QWindowsOpenGLTester::DisableRotationFlag) + && !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) { + qCWarning(lcQpaGl, "Unable to disable rotation."); + } return glCtx; + } qCWarning(lcQpaGl, "System OpenGL failed. Falling back to Software OpenGL."); return QOpenGLStaticContext::create(true); // If ANGLE is requested, use it, don't try anything else. @@ -363,10 +370,14 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate() break; } - const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(); if (supportedRenderers & QWindowsOpenGLTester::DesktopGl) { - if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) + if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) { + if ((supportedRenderers & QWindowsOpenGLTester::DisableRotationFlag) + && !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) { + qCWarning(lcQpaGl, "Unable to disable rotation."); + } return glCtx; + } } if (QWindowsOpenGLTester::Renderers glesRenderers = supportedRenderers & QWindowsOpenGLTester::GlesMask) { if (QWindowsEGLStaticContext *eglCtx = QWindowsEGLStaticContext::create(glesRenderers)) diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index e32a7e32af..fcbe488f93 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -268,7 +268,10 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c result &= ~QWindowsOpenGLTester::AngleRendererD3d9; } } - + if (features.contains(QStringLiteral("disable_rotation"))) { + qCDebug(lcQpaGl) << "Disabling rotation: " << gpu; + result |= DisableRotationFlag; + } srCache->insert(qgpu, result); return result; #endif // !Q_OS_WINCE && !QT_NO_OPENGL diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h index f22031aa4e..0fad3d960e 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.h +++ b/src/plugins/platforms/windows/qwindowsopengltester.h @@ -76,7 +76,9 @@ public: AngleBackendMask = AngleRendererD3d11 | AngleRendererD3d9 | AngleRendererD3d11Warp, Gles = 0x0010, // ANGLE/unspecified or Generic GLES for Windows CE. GlesMask = Gles | AngleBackendMask, - SoftwareRasterizer = 0x0020 + SoftwareRasterizer = 0x0020, + RendererMask = 0x00FF, + DisableRotationFlag = 0x0100 }; Q_DECLARE_FLAGS(Renderers, Renderer) |