[Interest] problem with QFontComboBox on mac/os

maitai maitai at virtual-winds.org
Thu Jun 11 20:37:51 CEST 2015


Hello,

I'm using qt 5.4.2 on Mac OS X 10.0-YOSEMITE.

I have a plain basic QFontComboxBox with all default options (all fonts 
allowed, etc). I'm trying to set the current font to whatever is 
QApplication::font().

I tried both

box->setCurrentText(qApp->font().family());

and

box->setCurrentFont(qApp->font());

but this does not work, because strangely enough there is no such family 
font listed in the QFontComboBox...

qApp->font().family() returns ".Helvetica Neue DeskInterface". The 
closest match in the list is "Helvetica Neue" but it cannot find it.

As a result when the user presses OK the font is set to the first font 
listed, which is "Al Bayan" and gives nice results if you like fancy 
fonts ;)

I ended up removing "." and " DeskInterface" from the string returned by 
qApp->font().policy() but this is just sad...

Any clue?

Thanks
Philippe Lelong



More information about the Interest mailing list