This may be helpful to others who find this thread, as I did, when I ran into similar problems.
I was primarily developing a PyQt5
app on my Windows 10 laptop with a high dpi display. I noticed strange behavior when projecting my screen or moving the app to a different display in a dual monitor setup. Basically, font sizes would change dramatically, and that caused all kinds of problems with the layout.
Ultimately, reading about High DPI Desktop App Dev from Windows got me to the solution. They recommend using Per-Monitor (V2) DPI Awareness
. It seems that Qt5
doesn't have support for this, but Qt6 does, and it is set appropriately by default.
So merely upgrading my dependency on PyQt5
to PyQt6
solved my problems. The version upgrade required some minor edits to my code. One minor hiccup was that QAction
moved to the QtGui
module from QtWidgets
.