Check if a font is Serif / SansSerif
-
@Pickaboo
how did you use the stylehint?
Did you use QFontInfo on an already selected QFont and then check the style hint? -
I'm a little late to this thread, but I need to do this, too, and I haven't found a way yet.
Just a note that according to the help documents,
QFontInfo
only returns the style hint that was set in its font which was used to create it:QFont::StyleHint QFontInfo::styleHint() const ...etc. ... "Currently only returns the style hint set in QFont."
So it is not really necessary to create a
QFontInfo
object from the font since this function seems to be just as useless asQFont::styleHint()
is (to me, at any rate).I expect that there might be a way to get this information, at least from TrueType or OpenType fonts, by examining the font file itself. However, it looks like there is no API exposed by Qt to do this through the existing interfaces.