diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 1c4cad7afe..17ed82c730 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -997,16 +997,12 @@ QRenderRule::QRenderRule(const QVector &declarations, const QObject } } - if (object) { + if (const QWidget *widget = qobject_cast(object)) { QStyleSheetStyle *style = const_cast(globalStyleSheetStyle); - if (!style) { - if (const QWidget *widget = qobject_cast(object)) { - style = qobject_cast(widget->style()); - if (style) - fixupBorder(style->nativeFrameWidth(widget)); - } - } - + if (!style) + style = qobject_cast(widget->style()); + if (style) + fixupBorder(style->nativeFrameWidth(widget)); } if (hasBorder() && border()->hasBorderImage()) defaultBackground = QBrush();