static const QFont using QFontDatabase?
-
Hello Qt community,
this is a follow-up question regarding an earlier thread I started: https://forum.qt.io/topic/58826/qfontdatabase-causes-segfault-solved
Does this mean I can't load a QFont onto a static const class member? static const class members are always evaluated before
main
is run, and unfortunately it is not possible to declare any QApplication instance before that.Thanks in advance for your help.
-
Hi,
Why do you need a static QFont ?
-
That's what I thought but what would be the use of that global QFont ?
-
Are these functions in separated classes ?
-
Then why not just make it a member and load it at construction time ?
-
@SGaist I could do that, but it's the same font for all instances. So it would be kind of a waste of space.
So it would be kind of a waste of space.
Hello,
I suggest answering these two questions for your own peace of mind:- How much space would you expect to save if you put it in a static variable?
- What do you gain or lose by making it a static and is it worth the effort (in work time/planning time)?
Kind regards.