[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] DPI scaling on windows
From:       Matic Kukovec <kukovecmatic () hotmail ! com>
Date:       2019-11-26 11:01:34
Message-ID: AM6PR01MB4198835F0874B2B0A042C92BD7450 () AM6PR01MB4198 ! eurprd01 ! prod ! exchangelabs ! com
[Download RAW message or body]

Hi guys,

I'm trying to get a robust way of handling Windows 10 DPI and scaling issues.
If I turn on the PyQt's automatic DPI hangling via:
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
and:
app.setAttribute(data.Qt.AA_EnableHighDpiScaling)

This works great if the Windows "Scaling" option is set to 100%. Now when the scaling \
is not 100%, weird things start happening to the application, like:
icons in labels and buttons look pixelated,
text and cursor in QScintilla editors is displayed incorrectly,
...

But if these PyQt DPI options I mentioned above are not set,
then the application window gets unmanageably big.

Is there a way to either fix the issues described above with the DPI settings, or is \
there some way to get accurate DPI information when not using PyQt's DPI options (so \
that the scaling of all widgets could be manually adjusted)?

Thanks,
Matic


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} \
</style> </head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> Hi guys,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> I'm trying to get a robust way of handling Windows 10 DPI and scaling \
issues.</div> <div style="font-family: Calibri, Helvetica, sans-serif; font-size: \
12pt; color: rgb(0, 0, 0);"> If I turn on the PyQt's automatic DPI hangling \
via:</div> <blockquote style="margin-top: 0px; margin-bottom: 0px;">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> os.environ[&quot;QT_AUTO_SCREEN_SCALE_FACTOR&quot;] = \
&quot;1&quot;</div> </blockquote>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> and:<br>
</div>
<blockquote style="margin-top: 0px; margin-bottom: 0px;">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> app.setAttribute(data.Qt.AA_EnableHighDpiScaling)</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
</blockquote>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> This works great if the Windows &quot;Scaling&quot; option is set to \
100%. Now when the scaling is not 100%,</div> <div style="font-family: Calibri, \
Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> weird things start \
happening to the application, like:</div> <blockquote style="margin-top: 0px; \
margin-bottom: 0px;"> <div style="font-family: Calibri, Helvetica, sans-serif; \
font-size: 12pt; color: rgb(0, 0, 0);"> icons in labels and buttons look \
pixelated,</div> </blockquote>
<blockquote style="margin-top: 0px; margin-bottom: 0px;">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> text and cursor in QScintilla editors is displayed incorrectly,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
                rgb(0, 0, 0);">
...</div>
</blockquote>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> But if these PyQt DPI options I mentioned above are not set,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> then the application window gets unmanageably big.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> Is there a way to either fix the issues described above with the DPI \
settings, or is there some way to get accurate DPI information when not using PyQt's \
DPI options (so that the scaling of all widgets could be manually adjusted)?</div> \
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> Thanks,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> Matic<br>
</div>
</body>
</html>


[Attachment #4 (unknown)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic