From 62bcd24c9a9e3310d2eb46d0876f22ef30a24451 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 8 Dec 2016 09:45:46 +0100 Subject: [PATCH] Enable HighDPI scaling This should scale up things automatically, without needing to set e.g. default-zoom (at least with QtWebEngine). See #1993, #1585 --- qutebrowser/app.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index de8a131ad..62cbf48c3 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -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")