Change the font of the application
-
I want to change the application font for everything. In the main file I tried to load a font using
QFont
and setting it to theQMainWindow
withsetFont
and it works normally, the problem is that if I change the stylesheet of any widget in it like to set thefont-weight
tobold
it requires me to usefont-family
as well in the stylesheet or it will switch to the default font automatically. If I use thesetFont
on theQApplication
it works better than inQMainWindow
, I don't have to specify the font family in the stylesheet, only setting thefont-weight
tobold
will still use the same font, the problem is that the fonts are way bigger than normal.How to set the font to the entire application?
-
I want to change the application font for everything. In the main file I tried to load a font using
QFont
and setting it to theQMainWindow
withsetFont
and it works normally, the problem is that if I change the stylesheet of any widget in it like to set thefont-weight
tobold
it requires me to usefont-family
as well in the stylesheet or it will switch to the default font automatically. If I use thesetFont
on theQApplication
it works better than inQMainWindow
, I don't have to specify the font family in the stylesheet, only setting thefont-weight
tobold
will still use the same font, the problem is that the fonts are way bigger than normal.How to set the font to the entire application?
Hi,
Maintain common stylesheet string for whole application keep it in common class. that string should contain font family and font width as well. wherever you want to use the stylesheet make use of that string directly so that it avoids writing the styleseet properties multiple time.
-
Hi,
Maintain common stylesheet string for whole application keep it in common class. that string should contain font family and font width as well. wherever you want to use the stylesheet make use of that string directly so that it avoids writing the styleseet properties multiple time.
@Venkatesh-V Instead of doing that isn't it better to use stylesheets already like this?
* { font-family: ... font-size: 16px; }
I asked about the usage of
setFont
because it's faster than using CSS, but well... -
@Venkatesh-V Instead of doing that isn't it better to use stylesheets already like this?
* { font-family: ... font-size: 16px; }
I asked about the usage of
setFont
because it's faster than using CSS, but well...