Change Qt font to native system default font

In my native Cocoa app (on OSX 10.10) the buttons look like this:

native OSX

In Qt (4.8.6) the buttons look like this:

Qt

As you can see, the font is different and the text is not vertically centered.

How can I use Qt for the system standard font and how can I vertically center the text in buttons? (The Qt font is the same (wrong) in all other widgets, so buttons are just an example.)


Through this , this and this :

I added this code which corrects it somewhat (it is now correctly centered), I think the font is different but still not correct.

#ifdef Q_OS_MACX
    // fix OSX 10.9 font
    // http://successfulsoftware.net/2013/10/23/fixing-qt-4-for-mac-os-x-10-9-mavericks/
    // https://bugreports.qt.io/browse/QTBUG-32789
    QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
    // fix OSX 10.10 font
    // https://bugreports.qt.io/browse/QTBUG-40833
    QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Helvetica Neue");
#endif

      

It now looks like this:

qt-with-fix

I've also tried Qt 5.3.2, but there is no difference:

qt5

+3


source to share





All Articles