summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-09-03 13:43:16 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-09-03 13:43:16 (GMT)
commitfcc4d041849ec4ea4f5c9e213a59926a57427aca (patch)
treed4900da0dae21d308864f09d4f0d170be949bb83 /src
parentf0388cbc7e720a268d95f9e08ad9c77ded000b79 (diff)
downloadQt-fcc4d041849ec4ea4f5c9e213a59926a57427aca.zip
Qt-fcc4d041849ec4ea4f5c9e213a59926a57427aca.tar.gz
Qt-fcc4d041849ec4ea4f5c9e213a59926a57427aca.tar.bz2
QS60Style: QToolbar button and checked state is not shown
QS60Style ignores Style_On state for QToolButton drawing. This has been fixed, so that when toolbutton is "on", button is drawn with pressed down graphics. Task-number: QTBUG-13099 Reviewed-by: Alessandro Portale
Diffstat (limited to 'src')
-rw-r--r--src/gui/styles/qs60style.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 36210b8..358c6aa 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1100,8 +1100,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
}
State mflags = bflags;
if (toolBtn->state & State_Sunken) {
- if (toolBtn->activeSubControls & SC_ToolButton)
- bflags |= State_Sunken;
+ bflags |= State_Sunken;
mflags |= State_Sunken;
}
@@ -1117,11 +1116,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (bflags & (State_Sunken | State_On | State_Raised | State_Enabled)) {
tool.rect = button.unite(menuRect);
tool.state = bflags;
- const QToolButton *toolButtonWidget = qobject_cast<const QToolButton *>(widget);
- const QS60StylePrivate::SkinElements element =
- ((toolButtonWidget && toolButtonWidget->isDown()) || (option->state & State_Sunken)) ?
- QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton;
- QS60StylePrivate::drawSkinElement(element, painter, tool.rect, flags);
drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
}
if (toolBtn->subControls & SC_ToolButtonMenu) {
@@ -2177,9 +2171,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_PanelButtonBevel:
case PE_FrameButtonBevel:
if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) {
- const bool isPressed = option->state & State_Sunken;
- const QS60StylePrivate::SkinElements skinElement =
- isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
+ const bool isPressed = (option->state & State_Sunken) || (option->state & State_On);
+ QS60StylePrivate::SkinElements skinElement;
+ if (element == PE_PanelButtonTool)
+ skinElement = isPressed ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton;
+ else
+ skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
} else {
commonStyleDraws = true;