summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-09-23 12:52:08 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-09-23 13:22:19 (GMT)
commite97b99f249ed65c6cedfc23f751a9834641271cb (patch)
treed8120b28fb710ccf4e687ad35659718709edaad7 /src/gui
parent2966b2a95b0d7d161a6dc1a6edab3d6aa6edf004 (diff)
downloadQt-e97b99f249ed65c6cedfc23f751a9834641271cb.zip
Qt-e97b99f249ed65c6cedfc23f751a9834641271cb.tar.gz
Qt-e97b99f249ed65c6cedfc23f751a9834641271cb.tar.bz2
Added QSlider to tst_QStyleSheetStyle::complexWidgetFocus.
When using style sheets, QSlider::handle couldn't be customized if QSlider::groove wasn't. QComboBox::down-arrow:focus wasn't properly drawn. Reviewed-by: Olivier
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp20
-rw-r--r--src/gui/styles/qwindowsstyle.cpp2
2 files changed, 15 insertions, 7 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index def82ae..0f3a88b 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -3136,19 +3136,25 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
rule.drawRule(p, opt->rect);
- QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove);
- if (!subRule.hasDrawable()) {
- baseStyle()->drawComplexControl(cc, slider, p, w);
- return;
+ QRenderRule grooveSubRule = renderRule(w, opt, PseudoElement_SliderGroove);
+ QRenderRule handleSubRule = renderRule(w, opt, PseudoElement_SliderHandle);
+ if (!grooveSubRule.hasDrawable()) {
+ QStyleOptionSlider slOpt(*slider);
+ bool handleHasRule = handleSubRule.hasDrawable();
+ // If the style specifies a different handler rule, draw the groove without the handler.
+ if (handleHasRule)
+ slOpt.subControls &= ~SC_SliderHandle;
+ baseStyle()->drawComplexControl(cc, &slOpt, p, w);
+ if (!handleHasRule)
+ return;
}
QRect gr = subControlRect(cc, opt, SC_SliderGroove, w);
if (slider->subControls & SC_SliderGroove) {
- subRule.drawRule(p, gr);
+ grooveSubRule.drawRule(p, gr);
}
if (slider->subControls & SC_SliderHandle) {
- QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderHandle);
QRect hr = subControlRect(cc, opt, SC_SliderHandle, w);
QRenderRule subRule1 = renderRule(w, opt, PseudoElement_SliderSubPage);
@@ -3169,7 +3175,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
subRule2.drawRule(p, r);
}
- subRule.drawRule(p, subRule.boxRect(hr, Margin));
+ handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin));
}
if (slider->subControls & SC_SliderTickmarks) {
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 2ed9303..0f72440 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -3030,6 +3030,8 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
ar.adjust(2, 2, -2, -2);
if (opt->state & State_Enabled)
flags |= State_Enabled;
+ if (opt->state & State_HasFocus)
+ flags |= State_HasFocus;
if (sunkenArrow)
flags |= State_Sunken;