Fix widget borders when using global stylesheetstyle
authorMiikka Heikkinen <miikka.heikkinen@digia.com>
Tue, 23 Oct 2012 08:50:13 +0000 (11:50 +0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 25 Oct 2012 08:20:27 +0000 (10:20 +0200)
Recent fixes to stylesheetstyle caused not calling fixupBorder()
when globalStyleSheetStyle is used.

Task-number: QTBUG-27651
Change-Id: I73263c951e2db7d574e81da3f60a1b79f3852716
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
src/widgets/styles/qstylesheetstyle.cpp

index 1c4cad7..17ed82c 100644 (file)
@@ -997,16 +997,12 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject
         }
     }
 
-    if (object) {
+    if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
         QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle);
-        if (!style) {
-            if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
-                style = qobject_cast<QStyleSheetStyle *>(widget->style());
-                if (style)
-                    fixupBorder(style->nativeFrameWidth(widget));
-            }
-        }
-
+        if (!style)
+            style = qobject_cast<QStyleSheetStyle *>(widget->style());
+        if (style)
+            fixupBorder(style->nativeFrameWidth(widget));
     }
     if (hasBorder() && border()->hasBorderImage())
         defaultBackground = QBrush();