Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt 5 and 4k screen

I'm trying to migrate an existing PyQt5 app to high-dpi for window 10.

The documentation of Qt5 itself speak about high-dpi scaling here: http://doc.qt.io/qt-5/highdpi.html

QT_AUTO_SCREEN_SCALE_FACTOR to "1".

But i can't adapt this in python code :/

Any idea ?

like image 868
n0tis Avatar asked Dec 26 '16 12:12

n0tis


1 Answers

Make sure you're on Qt 5.6+, skim the docs to be aware, then change your app init code to include one line before it and one line after it (written in Python) but it would be similar in C++:

os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
qapp = QApplication(sys.argv)
qapp.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
like image 54
Jonathan Avatar answered Nov 14 '22 23:11

Jonathan