diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-05-22 13:16:48 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-05-22 13:16:48 (GMT) |
commit | 3c6166983d07b6e81992b8a6080942041e37f615 (patch) | |
tree | 42f862502dbdd269062ee4a2dcc978dff051fd40 /src/gui/styles/qs60style.cpp | |
parent | f4742056eee31b9e293e5507bc10da7f81a1ebea (diff) | |
download | Qt-3c6166983d07b6e81992b8a6080942041e37f615.zip Qt-3c6166983d07b6e81992b8a6080942041e37f615.tar.gz Qt-3c6166983d07b6e81992b8a6080942041e37f615.tar.bz2 |
S60Style: Make 'checkable' buttons just 'pressed down' when checked.
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 9a35760..a13f396 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1184,21 +1184,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); - if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget))) { - if (buttonWidget->isCheckable()) { - QStyleOptionButton checkopt = subopt; - - const int indicatorHeight(pixelMetric(PM_IndicatorHeight)); - const int verticalAdjust = (option->rect.height() - indicatorHeight) >> 1; - - checkopt.rect.adjust(pixelMetric(PM_ButtonMargin), verticalAdjust, 0, 0); - checkopt.rect.setWidth(pixelMetric(PM_IndicatorWidth)); - checkopt.rect.setHeight(indicatorHeight); - - drawPrimitive(PE_IndicatorCheckBox, &checkopt, painter, widget); - } - } - drawControl(CE_PushButtonLabel, &subopt, painter, widget); if (btn->state & State_HasFocus) { QStyleOptionFocusRect fropt; @@ -1215,7 +1200,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StyleEnums::SkinParts skinPart; QS60StylePrivate::SkinElements skinElement; if (!isDisabled) { - const bool isPressed = option->state & QStyle::State_Sunken; + const bool isPressed = (option->state & QStyle::State_Sunken) || + (option->state & QStyle::State_On); if (isFlat) { skinPart = isPressed ? QS60StyleEnums::SP_QsnFrButtonTbCenterPressed : QS60StyleEnums::SP_QsnFrButtonTbCenter; @@ -1238,14 +1224,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_PushButtonLabel: if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { QStyleOptionButton optionButton = *button; - - if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget))) { - if (buttonWidget->isCheckable()) { - // space for check box. - optionButton.rect.adjust(pixelMetric(PM_IndicatorWidth) - + pixelMetric(PM_ButtonMargin) + pixelMetric(PM_CheckBoxLabelSpacing), 0, 0, 0); - } - } QCommonStyle::drawControl(element, &optionButton, painter, widget); } break; |