On 2019-10-23 20:49, Elvis Stansvik wrote:
Den ons 23 okt. 2019 kl 20:18 skrev Ville Voutilainen
<ville.voutilai...@gmail.com>:
On Wed, 23 Oct 2019 at 18:49, Elvis Stansvik <elvst...@gmail.com> wrote:
Den ons 23 okt. 2019 16:29Henry Skoglund <he...@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
In my case, I apply the font setting as a "look and feel" or signature telling the user that it's an app from me. Granted, a big/complicated application you'll be doing all of the widget settings more or less explicitly anyway. This is more of a concern for me for short-lived apps (say 500 lines in mainwindow.cpp) that I want to churn out quickly for a specific reason, but nevertheless convey my signature "look and feel".

Note that the point size of the font is lost as well when the propagation parent to child widget fails. For example, I use a 16-point sized font (because many of my users are old doctors) but the default vanilla font that appears (in my example for Windows it's in QListWidget and QTableWidget ) is Tahoma 8.25-point size. So even if I can live with Tahoma the point size of the font needs to be almost doubled.

Also. I think this is a philosophical question, because if you look at the "Before w.show():" debug output in my example, all the widgets answers: "Yes sir, we have got your order, we'll be showing the Courier font when the party starts". Except that some of them don't (unless you're on Linux).

I mean, I could live with this if the widgets that cannot deliver would tell me so, i.e. if they would answer "Tahoma" instead of "Courier" when I ask them in the "Before w.show():" section. And the fact that I have to pull that grapefruit trick indicates that the widget has received the font change, but not completely :-(

Rgrds Henry

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to