From b3fa02d0ed16f8a63654e17ed089fab091e1abc9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 20 Apr 2015 12:36:12 +0200 Subject: [PATCH] Automatically choose device pixel ratio Change-Id: Ic595ee0f45b7d3ec22b4c4086c0c6785b41c21f4 Task-number: QTCREATORBUG-11179 Reviewed-by: Friedemann Kleint Reviewed-by: Eike Ziller --- src/app/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index 7092c897208..5a49d3da4e2 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -291,6 +292,8 @@ static inline QSettings *userSettings() int main(int argc, char **argv) { + if (!qEnvironmentVariableIsSet("QT_DEVICE_PIXEL_RATIO")) + qputenv("QT_DEVICE_PIXEL_RATIO", "auto"); QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false")); #ifdef Q_OS_MAC // increase the number of file that can be opened in Qt Creator. @@ -303,6 +306,11 @@ int main(int argc, char **argv) SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv); + if (!qFuzzyCompare(qApp->devicePixelRatio(), 1.0) + && QApplication::style()->objectName().startsWith( + QLatin1String("windows"), Qt::CaseInsensitive)) { + QApplication::setStyle(QLatin1String("fusion")); + } const int threadCount = QThreadPool::globalInstance()->maxThreadCount(); QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));