From 9b0502aa6abf6bb9c07f205bccdf2d9c65027bde Mon Sep 17 00:00:00 2001
From: Olivier Goffart <ogoffart@trolltech.com>
Date: Fri, 8 Jan 2010 10:18:52 +0100
Subject: Fixes: Checked QPushbutton ignores stylesheet backround:

This is because the light() color of the palette is used and it was
not modified.

Task-number: QTBUG-7216
Reviewed-by: jbache
---
 src/gui/styles/qstylesheetstyle.cpp                |  6 ++++
 .../uiloader/baseline/css_buttons_background.ui    | 39 ++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index aff3ac0..56cc364 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1350,6 +1350,12 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette
         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())
diff --git a/tests/auto/uiloader/baseline/css_buttons_background.ui b/tests/auto/uiloader/baseline/css_buttons_background.ui
index f1fa0bc..3d80aeb 100644
--- a/tests/auto/uiloader/baseline/css_buttons_background.ui
+++ b/tests/auto/uiloader/baseline/css_buttons_background.ui
@@ -89,6 +89,19 @@ color: yellow;
         </property>
        </widget>
       </item>
+      <item row="5" column="0">
+       <widget class="QPushButton" name="pushButton_4">
+        <property name="text">
+         <string>Checked</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
@@ -149,6 +162,19 @@ color: yellow;
         </property>
        </widget>
       </item>
+      <item row="5" column="0">
+       <widget class="QPushButton" name="pushButton_5">
+        <property name="text">
+         <string>Checked</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
@@ -209,6 +235,19 @@ color: yellow;
         </property>
        </widget>
       </item>
+      <item row="5" column="0">
+       <widget class="QPushButton" name="pushButton_6">
+        <property name="text">
+         <string>Checked</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
-- 
cgit v0.12