Handle Qt::WA_MacSmallSize in QApplication::font(const QWidget *).

Task-number: QTBUG-27669
Task-number: QTBUG-27665
Change-Id: Id7eb8092076a57a755a53d1eb5c46d706756ca81
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Friedemann Kleint 2012-11-19 14:57:11 +01:00 committed by The Qt Project
parent 9a6367a72a
commit e671110a10

View File

@ -1512,6 +1512,14 @@ QFont QApplication::font(const QWidget *widget)
FontHash *hash = app_fonts();
if (widget && hash && hash->size()) {
#ifdef Q_OS_MAC
// short circuit for small and mini controls
if (widget->testAttribute(Qt::WA_MacSmallSize)) {
return hash->value(QByteArrayLiteral("QSmallFont"));
} else if (widget->testAttribute(Qt::WA_MacMiniSize)) {
return hash->value(QByteArrayLiteral("QMiniFont"));
}
#endif
QHash<QByteArray, QFont>::ConstIterator it =
hash->constFind(widget->metaObject()->className());
if (it != hash->constEnd())