If the styleName property is set for a QFont, using setBold(true) would
lead to Qt using an "emboldended"/synthetic font style instead of using
the bold style provided by the font itself (usually as a standalone font
file), the former looks ugly (IIUC, Freetype emboldens fonts as a last
resort for fonts that don't provide a bold style at all).
Accoring to upstream[1] the styleName property is useful for fonts with
fancy style names, and also it shouldn't be set if it's not needed; and
indeed using styleName with e.g. "Regular" doesn't make sense, as there
is no "Regular Bold" style AFAICS.
Checking for "Regular|Normal|Book|Roman" is based on examining the font
styles provided by the font packages available on OpenSuse Tumbleweed ATM,
(I didn't include some of the weird/non-common ones e.g. I've seen "Roma"
and "Rounded"). Some statistics about the "Regular"-like font styles from
my testing:
Regular: 2486
Normal: 66
Book: 20
Roman: 13
For more details see:
[1] https://bugreports.qt.io/browse/QTBUG-63792
https://bugs.kde.org/show_bug.cgi?id=378523
BUG: 378523
FIXED-IN: 5.68