View Full Version : Fonts, Colors, and QStyle

6th February 2006, 23:10
Hello - I am new to QT so please forgive my ignorance, but I am having trouble understanding the relationship between QStyle, colors, and fonts.

I have read the documentation for QStyle documentation and noted that it contains a method called standardPalette() which lets me set the standard colors for my custom style. I cannot find any methods that will allow me to set fonts for my custom style - is this something I would set in my QStyle object, or does the font belong to the QApplication object outside the style (QApplication::font()) ? I would have thought that font would be part of the style...

Thanks in advance,


28th September 2006, 08:26
A very old thread, but maybe it's worth to answer anyway... The font for QStyle is taken from QPainter object which, as you may see by looking at QStyle reference, is always passed as a parameter for style methods. Therefore the proper way to set the font is to use QApplication::setFont(). Storing the font directly in style wouldn't have much sense, as it could introduce problems with encodings and L-t-R languages.