1
0
Fork 0
mirror of synced 2024-06-14 16:44:42 +12:00

Application: set HiDPi scaling attribute

This commit is contained in:
loathingKernel 2022-10-26 01:33:49 +03:00
parent 9fcb924ae8
commit a5c8d92e24
3 changed files with 9 additions and 5 deletions

View file

@ -8,7 +8,7 @@ from datetime import datetime
from typing import Optional
import requests.exceptions
from PyQt5.QtCore import QThreadPool, QTimer, pyqtSlot
from PyQt5.QtCore import QThreadPool, QTimer, pyqtSlot, Qt
from PyQt5.QtWidgets import QApplication, QMessageBox
from requests import HTTPError
@ -128,6 +128,8 @@ def start(args):
sys.excepthook = excepthook
while True:
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
app = App(args)
exit_code = app.exec_()
# if not restart

View file

@ -7,9 +7,10 @@ from argparse import Namespace
from logging import getLogger
from typing import Union, Optional
from PyQt5.QtCore import QObject, QProcess, pyqtSignal, QUrl, QRunnable, QThreadPool, QSettings
from PyQt5.QtCore import QObject, QProcess, pyqtSignal, QUrl, QRunnable, QThreadPool, QSettings, Qt
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtNetwork import QLocalServer, QLocalSocket
from PyQt5.QtWidgets import QApplication
from rare.lgndr.core import LegendaryCore
from rare.widgets.rare_app import RareApp
@ -217,6 +218,9 @@ class GameProcessApp(RareApp):
def start_game(args: Namespace):
args = InitArgs.from_argparse(args)
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
app = GameProcessApp(args)
app.setQuitOnLastWindowClosed(True)

View file

@ -6,7 +6,7 @@ import time
from argparse import Namespace
import legendary
from PyQt5.QtCore import Qt, QSettings, QTranslator, QT_VERSION_STR, PYQT_VERSION_STR
from PyQt5.QtCore import QSettings, QTranslator, QT_VERSION_STR, PYQT_VERSION_STR
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication
@ -21,8 +21,6 @@ class RareApp(QApplication):
def __init__(self, args: Namespace, log_file: str):
super(RareApp, self).__init__(sys.argv)
self.setQuitOnLastWindowClosed(False)
if hasattr(Qt, "AA_UseHighDpiPixmaps"):
self.setAttribute(Qt.AA_UseHighDpiPixmaps)
self.setApplicationName("Rare")
self.setOrganizationName("Rare")