From 6290343ce7b9b1facebcb7148fc41f775d9ae5fe Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 5 Feb 2024 12:24:48 +0100 Subject: [PATCH] Use better resolution of Ayon apps on 4k display Special get_qt_app is used instead of shared get_openpype_qt_app as we don't want to set application icon. --- openpype/hosts/fusion/api/menu.py | 32 ++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/fusion/api/menu.py b/openpype/hosts/fusion/api/menu.py index 0b9ad1a43b..53ff5af767 100644 --- a/openpype/hosts/fusion/api/menu.py +++ b/openpype/hosts/fusion/api/menu.py @@ -173,8 +173,38 @@ class OpenPypeMenu(QtWidgets.QWidget): set_asset_framerange() +def get_qt_app(): + """Main Qt application.""" + + app = QtWidgets.QApplication.instance() + if app is None: + for attr_name in ( + "AA_EnableHighDpiScaling", + "AA_UseHighDpiPixmaps", + ): + attr = getattr(QtCore.Qt, attr_name, None) + if attr is not None: + QtWidgets.QApplication.setAttribute(attr) + + policy = os.getenv("QT_SCALE_FACTOR_ROUNDING_POLICY") + if ( + hasattr( + QtWidgets.QApplication, "setHighDpiScaleFactorRoundingPolicy" + ) + and not policy + ): + QtWidgets.QApplication.setHighDpiScaleFactorRoundingPolicy( + QtCore.Qt.HighDpiScaleFactorRoundingPolicy.PassThrough + ) + + app = QtWidgets.QApplication(sys.argv) + + return app + + def launch_openpype_menu(): - app = QtWidgets.QApplication(sys.argv) + + app = get_qt_app() pype_menu = OpenPypeMenu()