From 3ebb7ab6b16e6a48e370a50587ebdcab999ce383 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 30 Mar 2021 11:02:20 -0400 Subject: [PATCH] Only activate Qt hidpi detection on windows for now --- piker/ui/_exec.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/piker/ui/_exec.py b/piker/ui/_exec.py index 2146cdd5..d621e98c 100644 --- a/piker/ui/_exec.py +++ b/piker/ui/_exec.py @@ -22,6 +22,7 @@ All global Qt runtime settings are mostly defined here. """ from typing import Tuple, Callable, Dict, Any import os +import platform import signal import time import traceback @@ -87,16 +88,19 @@ def current_screen() -> QtGui.QScreen: assert screen, "Wow Qt is dumb as shit and has no screen..." return screen -# XXX: pretty sure none of this shit works + +# XXX: pretty sure none of this shit works on linux as per: # https://bugreports.qt.io/browse/QTBUG-53022 +# it seems to work on windows.. no idea wtf is up. +if platform.system() == "Windows": -# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute -# must be set before creating the application -# if hasattr(Qt, 'AA_EnableHighDpiScaling'): -# QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) + # Proper high DPI scaling is available in Qt >= 5.6.0. This attibute + # must be set before creating the application + if hasattr(Qt, 'AA_EnableHighDpiScaling'): + QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) -# if hasattr(Qt, 'AA_UseHighDpiPixmaps'): -# QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) + if hasattr(Qt, 'AA_UseHighDpiPixmaps'): + QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) class MainWindow(QtGui.QMainWindow):