src/gui/styles/qstylesheetstyle.cpp
changeset 30 5dc02b23752f
parent 23 89e065397ea6
child 33 3e2da88830cd
--- a/src/gui/styles/qstylesheetstyle.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/styles/qstylesheetstyle.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -1065,7 +1065,7 @@
             r.adjust(-p[LeftEdge], -p[TopEdge], p[RightEdge], p[BottomEdge]);
         }
     }
-    if (!hasNativeBorder() && (flags & Border)) {
+    if (hasBorder() && (flags & Border)) {
         const int *b = border()->borders;
         r.adjust(-b[LeftEdge], -b[TopEdge], b[RightEdge], b[BottomEdge]);
     }
@@ -1352,6 +1352,12 @@
         if (br != QPalette::NoRole)
             p->setBrush(br, bg->brush);
         p->setBrush(QPalette::Window, bg->brush);
+        if (bg->brush.style() == Qt::SolidPattern) {
+            p->setBrush(QPalette::Light, bg->brush.color().lighter(115));
+            p->setBrush(QPalette::Midlight, bg->brush.color().lighter(107));
+            p->setBrush(QPalette::Dark, bg->brush.color().darker(150));
+            p->setBrush(QPalette::Shadow, bg->brush.color().darker(300));
+        }
     }
 
     if (!hasPalette())
@@ -2537,7 +2543,7 @@
         int state;
         QPalette::ColorGroup group;
     } map[3] = {
-        { PseudoClass_Active | PseudoClass_Enabled, QPalette::Active },
+        { int(PseudoClass_Active | PseudoClass_Enabled), QPalette::Active },
         { PseudoClass_Disabled, QPalette::Disabled },
         { PseudoClass_Enabled, QPalette::Inactive }
     };
@@ -3170,8 +3176,8 @@
                 if (subRule1.hasDrawable()) {
                     QRect r(gr.topLeft(),
                             slider->orientation == Qt::Horizontal
-                                ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height())
-                                : QPoint(gr.x()+gr.width(), hr.y()+hr.height()/2));
+                                ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height() - 1)
+                                : QPoint(gr.x()+gr.width() - 1, hr.y()+hr.height()/2));
                     subRule1.drawRule(p, r);
                 }
 
@@ -3458,10 +3464,17 @@
 
     case CE_RadioButton:
     case CE_CheckBox:
-        rule.drawRule(p, opt->rect);
-        ParentStyle::drawControl(ce, opt, p, w);
-        return;
-
+        if (rule.hasBox() || !rule.hasNativeBorder() || rule.hasDrawable() || hasStyleRule(w, PseudoElement_Indicator)) {
+            rule.drawRule(p, opt->rect);
+            ParentStyle::drawControl(ce, opt, p, w);
+            return;
+        } else if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+            QStyleOptionButton butOpt(*btn);
+            rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button);
+            baseStyle()->drawControl(ce, &butOpt, p, w);
+            return;
+        }
+        break;
     case CE_RadioButtonLabel:
     case CE_CheckBoxLabel:
         if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {