From a53df3892a70f99910cfd085f2f2feca9e17d081 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 1 Dec 2017 15:26:27 +0100 Subject: [PATCH] Qt Quick Application wizards: No AA_EnableHighDpiScaling on Simulator Avoid setting Qt::AA_EnableHighDpiScaling when running in the simulator. Simulator detection is done by testing whether environment variable QTGLESSTREAM_DISPLAY is set. This amends 8c3bd6159436d099127bd9cbb8271be8e18f95a5 where all platforms except Windows were excluded from setting the flag. Task-number: QTBUG-64815 Change-Id: I8ab7ba9f24217915dc1d01e1f2eb5c37923c5504 Reviewed-by: Eike Ziller Reviewed-by: Rainer Keller --- .../wizards/projects/qtquickapplication/main.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp b/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp index 500db3de63c..986dcd606f1 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/main.cpp @@ -2,18 +2,20 @@ %{JS: QtSupport.qtIncludes([], ["QtGui/QGuiApplication", "QtQml/QQmlApplicationEngine"])} int main(int argc, char *argv[]) { -@if %{SetQPAPhysicalSize} - qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213")); - qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120")); - -@endif @if %{UseVirtualKeyboard} qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); @endif -#if defined(Q_OS_WIN) +@if %{SetQPAPhysicalSize} + if (qEnvironmentVariableIsEmpty("QTGLESSTREAM_DISPLAY")) { + qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213")); + qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120")); + + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + } +@else QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#endif +@endif QGuiApplication app(argc, argv);