Enable HighDPI scaling

This should scale up things automatically, without needing to set e.g.
default-zoom (at least with QtWebEngine).

See #1993, #1585
This commit is contained in:
Florian Bruhin 2016-12-08 09:45:46 +01:00
parent c7d4ea5247
commit 62bcd24c9a

View File

@ -34,7 +34,7 @@ import tokenize
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QDesktopServices, QPixmap, QIcon, QWindow
from PyQt5.QtCore import (pyqtSlot, qInstallMessageHandler, QTimer, QUrl,
QObject, QEvent, pyqtSignal)
QObject, QEvent, Qt, pyqtSignal)
try:
import hunter
except ImportError:
@ -70,6 +70,14 @@ def run(args):
quitter = Quitter(args)
objreg.register('quitter', quitter)
# Enable HighDPI
assert QApplication.instance() is None
try:
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
except AttributeError:
# Qt < 5.6
pass
global qApp
qApp = Application(args)
qApp.setOrganizationName("qutebrowser")