HiDPI monitors
Hans Jörg Maurer
hjm at pmeonline.net
Wed Jan 13 10:10:15 GMT 2021
Hi,
I have/had the same problem before. See code below which helps a
little. It doesn't resize if you move a window from a monitor with
standard size to 4k (in my case). But if I start the program on the
4k screen, scaling is normal.
I got this code from SO:
https://stackoverflow.com/questions/45949661/scale-qt-applications-nicely-with-4k-moniters
if hasattr(Qt, 'AA_EnableHighDpiScaling'):
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
Am Mittwoch, den 13.01.2021 um 10:51 schrieb ullix:
HiDPI monitors are giving me a headache, can someone help?
A user of my software has an 8k monitor at his laptop. Because all
software became illegibly small, he sat scaling to 200% (which suggest
that all his software, not just PyQt, has problems handling HiDPI
monitors ;-))
But now my software looks strangely inconsistent:
All button text has become illegible.
But the red text on the left (a QTextEdit()) is proper, and so is the
text in the light-yellow field above it (a QLineEdit().
However, the QLineEdit() "Time min" on the right side is distorted.
Is it relevant that this unlike the left one does NOT have an explicit
stylesheet set?
Is there anything I can do inside Py3/PyQt5 do remedy the situation or
at least improve it?
I know there is this command:
"QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)" which in
the above example is NOT active. It does't seem to do anything good on
a FullHD screen, except when using a Raspi with FullHD, where it
distorts the display big time. So I took it out.
I can't test a HiDPI screen at the moment. What benefit would/might it
have in this situation? Anything else to do?
ullix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210113/176ecd7c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nikgpgpcconokmmj.png
Type: image/png
Size: 245330 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210113/176ecd7c/attachment-0001.png>
More information about the PyQt
mailing list