From ff6b58c2659bbf7b106648ef223a8f5f22ccdaa2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 17 Dec 2019 18:43:32 +1000 Subject: [PATCH] opt in to qt's new non-integer scaling --- aqt/__init__.py | 3 +++ aqt/webview.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/aqt/__init__.py b/aqt/__init__.py index e706b3d8e..e252f7413 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -310,6 +310,9 @@ def _run(argv=None, exec=True): # opt in to full hidpi support? if not os.environ.get("ANKI_NOHIGHDPI"): QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "1" + os.environ["QT_SCALE_FACTOR_ROUNDING_POLICY"] = "PassThrough" + # Opt into software rendering. Useful for buggy systems. if os.environ.get("ANKI_SOFTWAREOPENGL"): diff --git a/aqt/webview.py b/aqt/webview.py index 13d7eec9a..633c867e1 100644 --- a/aqt/webview.py +++ b/aqt/webview.py @@ -200,7 +200,9 @@ class AnkiWebView(QWebEngineView): # type: ignore if isLin: factor = max(1, factor) return factor - # compensate for qt's integer scaling on windows + # compensate for qt's integer scaling on windows? + if qtminor >= 14: + return 1 qtIntScale = self._getQtIntScale(screen) desiredScale = factor * qtIntScale newFactor = desiredScale / qtIntScale