opt in to qt's full hidpi support

doesn't seem to affect the webviews on Linux, so we need to keep the old
zoom code around for now
This commit is contained in:
Damien Elmes 2017-08-10 15:02:46 +10:00
parent 4dae8ef661
commit a57b913450
2 changed files with 7 additions and 1 deletions

View File

@ -214,6 +214,9 @@ def _run():
import ctypes
ctypes.CDLL('libGL.so.1', ctypes.RTLD_GLOBAL)
# opt in to full hidpi support
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
# create the app
app = AnkiApp(sys.argv)
QCoreApplication.setApplicationName("Anki")

View File

@ -6,7 +6,7 @@ import sys
from anki.hooks import runHook
from aqt.qt import *
from aqt.utils import openLink
from anki.utils import isMac, isWin, devMode
from anki.utils import isMac, isWin, isLin, devMode
# Page for debug messages
##########################################################################
@ -151,7 +151,10 @@ class AnkiWebView(QWebEngineView):
if oldFocus:
oldFocus.setFocus()
# need to do this manually for Linux as Qt doesn't automatically scale webview
def zoomFactor(self):
if not isLin:
return 1
screen = QApplication.desktop().screen()
dpi = screen.logicalDpiX()
return max(1, dpi / 96.0)