From d07618a20da8dcc8a4ae85d59ce82bc9fac49e8f Mon Sep 17 00:00:00 2001 From: chrisjbillington Date: Sat, 8 Apr 2023 20:37:17 +1000 Subject: [PATCH] Set some Qt settings to play nicer on High DPI displays `labscript_utils.splash` is the first place a `QApplication` gets created for all of our apps. So setting these settings there applies them to all our applications, although they are also needed for the splash screen itself to be scaled better on High DPI displays. `AA_EnableHighDpiScaling` scales all pixel metrics to the device pixel ratio - so this means curved edges and padding and whatnot get scaled up, as well as the size of some pixmaps. `AA_UseHighDpiPixmaps` means to use high DPI pixmaps for icons etc, directly, rather than rendering them at the lower resolution and then scaling them up (not sure why anyone would want the latter behaviour). Strangely, high resolution pixmaps *are* used when `AA_EnableHighDpiScaling` is *off*. It's only when it is turned on that they get downscaled and then upscaled again and end up blocky. --- labscript_utils/splash.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/labscript_utils/splash.py b/labscript_utils/splash.py index 3aecf8a..e00c892 100644 --- a/labscript_utils/splash.py +++ b/labscript_utils/splash.py @@ -29,6 +29,15 @@ Qt = QtCore.Qt +# Set auto high-DPI scaling - this ensures pixel metrics are scaled +# appropriately so that we don't get a weird mix of large fonts and small +# everything else on High DPI displays: +QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) +# Use high res pixmaps if available, instead of rendering at low resolution and +# upscaling: +QtWidgets.QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) + + class Splash(QtWidgets.QFrame): w = 250 h = 230 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy