Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Setting QApplication::setFont messes up QMessageBox appearance on macOS
mourke last edited by mourke
I have recently ported my Qt app to macOS and the last bump in the road is that the QMessageBox buttons appear very weirdly when
If I remove the call to
QApplication::setFontthis is what I see (correct)
However if I add it this is what I see:
This line is all I'm changing:
QApplication::setFont(QFont("Avenir", FONT_SIZE_NORMAL, QFont::Black));and it functions perfectly on windows just not macOS.
I'm using Qt version 5.12.0 and am updating to 5.14.1 just in case it's an issue with that. I'm using Qt Creator 4.8 too.
My QMessageBox code looks like this (no styling of any kind):
QMessageBox messageBox; messageBox.setIcon(QMessageBox::Icon::Information); messageBox.setWindowTitle(tr("Updates Found")); messageBox.setText("Version 1 is now available to download"); auto okButton = messageBox.addButton(QMessageBox::Ok); auto skipButton = messageBox.addButton(tr("Skip"), QMessageBox::ButtonRole::NoRole); auto updateButton = messageBox.addButton(tr("Update"), QMessageBox::ButtonRole::YesRole); messageBox.exec();
JonB last edited by
Is it the changed size or the changed button look that bothers you (not that I know the answer).
FWIW, I'd just try leaving the application font alone and test using
messageBox.setFont()to verify it's not actually an issue about