Important: Please read the Qt Code of Conduct -


  • Hey guys,

    I was thinking about what steps should I take to make my application compatible with different font sizes and other UI properties the user has defined in OS system settings.

    In Qt Creator, I tossed a couple of labels on a form and when I went to KDE Appearance setup to crank the general font size up, the text couldn't fit in the labels any more. Right now I'm on Windows, but I expect it's the same thing there.

    Should I write some code or is there some other logic available to take care of this? Many Qt apps seem to get this right somehow.

  • Moderators

    Did you use layouts in your test form or did you just drop labels on the form?

  • I just dropped them like that. But indeed it seems layouts might be exactly what I'm looking for, thanks!

  • First of all, you need to use anchors, as in case of Symbian and meego , maemo mobile apps.
    Then try setting the font sizes and other margins, etc by platformStyle properties...
    Try avoiding hard coding the values as much as possible.

    Try declaring heights and widths as fractions of screen size, etc, etc

  • Also try using layouts as suggested, but inside the layout properties, remember to use my tips :)

Log in to reply