summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qstylesheetstyle.cpp
diff options
context:
space:
mode:
authorRobert Griebl <rgriebl@trolltech.com>2010-03-03 14:44:46 (GMT)
committerRobert Griebl <rgriebl@trolltech.com>2010-03-03 14:45:41 (GMT)
commitd4bae0d0e96138d913bfc7ec9fa86b887043787f (patch)
treea93a5f60214f6be35e48ab462aceeee9a41856dd /src/gui/styles/qstylesheetstyle.cpp
parentaee5766de0ab6c942ae3e3747162871651a4ab74 (diff)
downloadQt-d4bae0d0e96138d913bfc7ec9fa86b887043787f.zip
Qt-d4bae0d0e96138d913bfc7ec9fa86b887043787f.tar.gz
Qt-d4bae0d0e96138d913bfc7ec9fa86b887043787f.tar.bz2
Fix for QRadioButtons and QCheckBoxes drawn incorrectly when a style sheet is set.
Maemo 5 draws these controls very differently, so we can't rely on QWindowStyle handling CE_RadioButton/CE_CheckBox. Task-number: QTBUG-8356 Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/styles/qstylesheetstyle.cpp')
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index bc1bece..5376386 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -3457,10 +3457,17 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
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)) {