From fca96bcb7bb31c159a51c9204bdcc1956914cf77 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 4 Oct 2022 18:03:54 +0200 Subject: [PATCH] set 'AA_EnableHighDpiScaling' attribute before application init --- openpype/tools/tray/pype_tray.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/openpype/tools/tray/pype_tray.py b/openpype/tools/tray/pype_tray.py index 8a24b3eaa6..3842a4e216 100644 --- a/openpype/tools/tray/pype_tray.py +++ b/openpype/tools/tray/pype_tray.py @@ -775,12 +775,26 @@ class PypeTrayStarter(QtCore.QObject): def main(): log = Logger.get_logger(__name__) app = QtWidgets.QApplication.instance() + + high_dpi_scale_attr = None if not app: + # 'AA_EnableHighDpiScaling' must be set before app instance creation + high_dpi_scale_attr = getattr( + QtCore.Qt, "AA_EnableHighDpiScaling", None + ) + if high_dpi_scale_attr is not None: + QtWidgets.QApplication.setAttribute(high_dpi_scale_attr) + app = QtWidgets.QApplication([]) + if high_dpi_scale_attr is None: + log.debug(( + "Attribute 'AA_EnableHighDpiScaling' was not set." + " UI quality may be affected." + )) + for attr_name in ( - "AA_EnableHighDpiScaling", - "AA_UseHighDpiPixmaps" + "AA_UseHighDpiPixmaps", ): attr = getattr(QtCore.Qt, attr_name, None) if attr is None: