QStyleSheetStyle: don't call pixelMetric when not needed

fixupBorder does nothing when bd is null, i.e. hasBorder() returns false.

Change-Id: Ic88e3a793f32bd4ad25830ddad9dbd8100348279
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
David Faure 2016-08-23 22:34:21 +02:00
parent 2c5eb3e668
commit 35b871b2b6

View File

@ -996,15 +996,17 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject
}
}
if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);
if (!style)
style = qobject_cast<QStyleSheetStyle *>(widget->style());
if (style)
fixupBorder(style->nativeFrameWidth(widget));
if (hasBorder()) {
if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);
if (!style)
style = qobject_cast<QStyleSheetStyle *>(widget->style());
if (style)
fixupBorder(style->nativeFrameWidth(widget));
}
if (border()->hasBorderImage())
defaultBackground = QBrush();
}
if (hasBorder() && border()->hasBorderImage())
defaultBackground = QBrush();
}
QRect QRenderRule::borderRect(const QRect& r) const