Qt UI design for the PinePhone?
-
How can I adapt an existing Qt desktop application to also run suitably on the PinePhone, which runs various Linux distros?
I assume I would need to detect the DPI and scale all graphics to some readable resolution.
Two questions then:- How to detect the current screen's DPI?
- How to scale all graphics in a window?
Thanks.
-
Have you tried it yet? Qt is pretty good at DPI scaling.
-
This post is deleted!
-
@AnneRanch please calm down.
The question of @mattfbacon is pretty legitimate as it often happens that people start searching for screen related solutions before having tried to run their application on the target. Some application will require a redesign because interacting with a mobile phone screen is not the same as with a computer and some other time just recompiling is enough.
So knowing what has been tried beforehand is better than starting to shot suggestions in the dark.
-
@mattfbacon I don't have the phone yet. What is the API for DPI scaling in Qt?
-
-
@artwaw Ideally Qt would read the system-wide settings e.g. if the font scaling adapts to 250 DPI then Qt would scale everything by 2.5X compared to a 100 DPI display. Looking at my Xfce based system I see that the DPI is stored in ~/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml ... but I wonder if there is another place at Qt looks.
-
My point is that worrying about scaling in Qt before trying it is a bit premature. For my Linux desktop, setting the environment variable QT_AUTO_SCREEN_SCALE_FACTOR to 1 worked like a charm, no application code required.
-
@mattfbacon I find that QT_SCALE_FACTOR=2 does an amazing job at scaling.
But I'm also wondering, is it real scaling at the pixel level, or is it just an OpenGL trick that makes that window bigger but the number of pixels in the window is unchanged?