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
QFontand setting it to theQMainWindowwithsetFontand it works normally, the problem is that if I change the stylesheet of any widget in it like to set thefont-weighttoboldit requires me to usefont-familyas well in the stylesheet or it will switch to the default font automatically. If I use thesetFonton theQApplicationit works better than inQMainWindow, I don't have to specify the font family in the stylesheet, only setting thefont-weighttoboldwill 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
QFontand setting it to theQMainWindowwithsetFontand it works normally, the problem is that if I change the stylesheet of any widget in it like to set thefont-weighttoboldit requires me to usefont-familyas well in the stylesheet or it will switch to the default font automatically. If I use thesetFonton theQApplicationit works better than inQMainWindow, I don't have to specify the font family in the stylesheet, only setting thefont-weighttoboldwill 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
setFontbecause 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
setFontbecause it's faster than using CSS, but well...