[Development] QWidget font settings propagation parent to child

Elvis Stansvik elvstone at gmail.com
Wed Oct 23 20:49:11 CEST 2019


Den ons 23 okt. 2019 kl 20:18 skrev Ville Voutilainen
<ville.voutilainen at gmail.com>:
>
> On Wed, 23 Oct 2019 at 18:49, Elvis Stansvik <elvstone at gmail.com> wrote:
> >
> > Den ons 23 okt. 2019 16:29Henry Skoglund <henry at tungware.se> skrev:
> >>
> >> Hi,
> >>
> >> I use Qt Creator's excellent Form Editor, however sometimes I've noticed an inconsistency in the font settings, because I'm lazy I usually only set the font property for the top MainWindow and relying on it to "trickle down" and affect the widgets as well. Except sometimes it doesn't trickle down :-( So I wrote a test app, just a main.cpp:
> >
> >
> > I don't want to be that person who always asks "why are you even doing this", but.. Why are you even doing this? :p
> >
> > Changing the font is normally not recommended. I think the best practice is to let the font remain as the platform plugin decided, so that the user's choice of font is respected.
>
> And if the user changes their choice, should it be possible to reflect
> that dynamically on a running application? I have no trouble coming up
> with dozens of use cases where you want to change the font of an
> application, or a part of its widget hierarchy.

I believe you get that for free if you leave the font alone. At least
my Qt applications change when I change my system font choice under
KDE.

Elvis


More information about the Development mailing list