opt in to qt's new non-integer scaling

This commit is contained in:
Damien Elmes 2019-12-17 18:43:32 +10:00
parent b9f564f49a
commit ff6b58c265
2 changed files with 6 additions and 1 deletions

View file

@ -310,6 +310,9 @@ def _run(argv=None, exec=True):
# opt in to full hidpi support? # opt in to full hidpi support?
if not os.environ.get("ANKI_NOHIGHDPI"): if not os.environ.get("ANKI_NOHIGHDPI"):
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) 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. # Opt into software rendering. Useful for buggy systems.
if os.environ.get("ANKI_SOFTWAREOPENGL"): if os.environ.get("ANKI_SOFTWAREOPENGL"):

View file

@ -200,7 +200,9 @@ class AnkiWebView(QWebEngineView): # type: ignore
if isLin: if isLin:
factor = max(1, factor) factor = max(1, factor)
return 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) qtIntScale = self._getQtIntScale(screen)
desiredScale = factor * qtIntScale desiredScale = factor * qtIntScale
newFactor = desiredScale / qtIntScale newFactor = desiredScale / qtIntScale