PDA

View Full Version : Qt5 Window Widget Application controls multiple screen resolutions



bgining2this
22nd July 2019, 19:52
Hello community !!!

I am very new to Qt5, just 3 days programming with it, but i have been programming for many years. The thing is that i have a question related to form controls, i have a monitor with a resolution of 1920 x 1080 if i develop the form controls and layout here, when i deploy the application in lower or bigger screens how the controls adapt? Just curious, because it will be my first application in Qt5. Thank you in advance !! :D

anda_skoa
23rd July 2019, 08:28
Properly layouted widget applications are dynamically resizeable.
I.e. unless you specifically prohibit it, a use can resize the window from as small as its inherent minimum size to as wide or height as they want to.

Qt can also deal with different DPI.

Cheers,
_

d_stranz
23rd July 2019, 19:14
One gotcha that I have found is in handling OS-based font scaling (e.g. Windows display setting to change the default font scale to something other than 100%). If you design a form and restrict the maximum size of certain child widgets so they look "attractive", then font scaling can result in unintended clipping when the UI is shown on a different display. If you don't set a maximum size, then Qt will expand the widgets to fit their contents (usually), but the downside is that sometimes the widgets can be too wide.

Layouts will stretch their contents to fill the available space, subject to app and default constraints, and sometimes the width is just too much to make an attractive form (list or combo boxes far too wide for their contents, for example). You can control this somewhat using layout spacer items (stretch), but it is often a compromise.

So it is good to test your UI under various display conditions.