From 8bb2e7f9985ffed657630160a7f601d96e4cfe45 Mon Sep 17 00:00:00 2001 From: Gabriel20xx Date: Thu, 7 Aug 2025 16:44:22 +0200 Subject: [PATCH] Refactor DPI awareness setup to use qt.conf for Windows --- main.py | 13 +------------ qt.conf | 5 ++++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index bcfff64..2f800e8 100644 --- a/main.py +++ b/main.py @@ -5165,18 +5165,7 @@ class ActionDialog(QtWidgets.QDialog): return {'type': self.type_combo.currentText(), 'params': params, 'image_refs': image_refs, 'logic': logic} if __name__ == '__main__': - # Set DPI awareness before creating QApplication to prevent access denied error - import os - if os.name == 'nt': # Windows - try: - from PyQt6.QtCore import Qt - # Set high DPI scaling policy before creating QApplication - QtWidgets.QApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough) - QtWidgets.QApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling, True) - QtWidgets.QApplication.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps, True) - except Exception as e: - logger.debug(f"DPI awareness setup failed: {e}") - + # qt.conf handles DPI awareness to prevent access denied errors app = QtWidgets.QApplication(sys.argv) win = MainWindow() win.show() diff --git a/qt.conf b/qt.conf index 44e2890..bb45c31 100644 --- a/qt.conf +++ b/qt.conf @@ -1,5 +1,8 @@ [Platforms] WindowsArguments = dpiawareness=0 +[QPA] +dpi = 96 + [Platforms\windows] -DpiAwareness = system +DpiAwareness = unaware