Unsolved Advice for best practice high-DPI development needed
-
Hello!
I'd like to ask for help concerning the general direction when developing a GUI with support for high-resolution / high-dpi displays as I find the official documentation lacking in this regard. To get the basics out of the way: We are using Qt 5.15, develop via Python / Pyside2 and aim at Windows as platform (with Linux being an option).
I've read through the documentation like this:
https://doc.qt.io/qt-5/highdpi.html
https://doc.qt.io/qt-5/scalability.html#loading-files-depending-on-platformWhat I'd like to know / what I don't quite get yet is the actual procedure one should follow when developing for displays with different resolutions / DPIs.
For example there is the concept of a virtualized coordinate system and concepts like physical DPI, logical DPI, device independent pixels and so on. I still don't quite get the actual approach behind all of this. Is there a way to define a virtual 1600x900 space (representing a 16:9 display format) where I arrange my GUI elements and this gets scaled to the actual screen resolution?Then there is the topic of bitmap images - there seems to be the concept of using different file name endings like "@2x". As far as I understand this is mimicing an Apple "automagic" method which was developed for their mobile devices and is adapted for Qt Quick. Or maybe not just that - it seems that the QIcon class in general scans for possible "@2x" files. It is not integrated for the general Pixmap classes though. I on the other hand found a python script that overrides the respective methods to add this functionality there too as can be seen here:
https://forum.qt.io/topic/43596/retina-2x-icons-are-not-being-loaded-from-resource-qrc/5Did someone here already adapt a Qt5 project for a Windows platform with high-DPI support who can give me some directions? I mean there of course are some automatic features like activating the QT_ENABLE_HIGHDPI_SCALING environment variable and one always has to never give absolute pixel sizes but it has to be an expression relative to the screen size. I don't see the best approach here though. What would be the best practice for doing this virtual coordinate system approach? The documentation says that this can be done but not how to do it. The same goes for using images of appropiate resolution so things don't get too blurred due to on-the-fly scaling. There is this "@2x" concept which seems to only be intended for Qt Quick development but is said to be implemented in the QIcon class in general which manually can be extended to Pixmap classes.
I'd appreciate some clarifications and best practive tips in this regard!