From d771646af348c8139c7e4a4bb729be03eda1fadf Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 4 Nov 2021 00:10:13 +0100 Subject: [PATCH] Set `Qt::AA_EnableHighDpiScaling` only before QGuiApplication is constructed Otherwise it is too late anyways and Qt might print a warning. --- resources/resources.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/resources.cpp b/resources/resources.cpp index 8e93bde..97ca479 100644 --- a/resources/resources.cpp +++ b/resources/resources.cpp @@ -314,7 +314,9 @@ bool hasCoreApp() void setupCommonQtApplicationAttributes() { #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); + if (!QCoreApplication::instance()) { + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); + } QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); #endif }