Minor optimization to QWidgetPrivate::naturalWidgetFont()

When inheritedMask is 0, the font inherits just everything; in this case
`inheritedFont.resolve(baseFont)` could be replaced with `baseFont`.

Change-Id: Ic3ed8ef174493544ada32037e7bdded46eb4bd43
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
bb10
Konstantin Ritt 2015-05-14 02:47:21 +04:00
parent 110a8c339f
commit cd0a125123
1 changed files with 10 additions and 6 deletions

View File

@ -4699,9 +4699,11 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const
if (QWidget *p = q->parentWidget()) {
if (!p->testAttribute(Qt::WA_StyleSheet)) {
if (!naturalFont.isCopyOf(QApplication::font())) {
QFont inheritedFont = p->font();
inheritedFont.resolve(inheritedMask);
naturalFont = inheritedFont.resolve(naturalFont);
if (inheritedMask != 0) {
QFont inheritedFont = p->font();
inheritedFont.resolve(inheritedMask);
naturalFont = inheritedFont.resolve(naturalFont);
} // else nothing to do (naturalFont = naturalFont)
} else {
naturalFont = p->font();
}
@ -4709,9 +4711,11 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const
}
#ifndef QT_NO_GRAPHICSVIEW
else if (extra && extra->proxyWidget) {
QFont inheritedFont = extra->proxyWidget->font();
inheritedFont.resolve(inheritedMask);
naturalFont = inheritedFont.resolve(naturalFont);
if (inheritedMask != 0) {
QFont inheritedFont = extra->proxyWidget->font();
inheritedFont.resolve(inheritedMask);
naturalFont = inheritedFont.resolve(naturalFont);
} // else nothing to do (naturalFont = naturalFont)
}
#endif //QT_NO_GRAPHICSVIEW
}