diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-03-05 20:16:53 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-06 17:24:31 +0100 |
commit | 4520cb98659960e343a3bcbcf4477858971290dc (patch) | |
tree | 0cf16a076ef549c54af8cf647da347019da403ce /src/widgets/styles/qmacstyle_mac.mm | |
parent | 6d3ab0c96b4372ebde610fd59196de7d321ac14c (diff) |
Mac: Fix inactive window appearance
The inactive palette values were set to be the same as the disabled
palettte whereas, on Mac, they are the same as the active palette.
Also, some of the logic to draw inactive looking widgets was a bit
dubious. Add to that the fact that HITheme is not responding to
kThemeStateInactive as expected, or so it looks.
Task-number: QTBUG-29860
Change-Id: I5d67765a9411a40449a8a4440276b2fad167f7c4
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac.mm')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index ea73ff6296..132cc8d59e 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1206,7 +1206,6 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn, const ThemeDrawState tds, HIThemeButtonDrawInfo *bdi) const { - bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active; ThemeDrawState tdsModified = tds; if (btn->state & QStyle::State_On) tdsModified = kThemeStatePressed; @@ -1214,7 +1213,7 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn, bdi->state = tdsModified; bdi->value = kThemeButtonOff; - if (drawColorless && tdsModified == kThemeStateInactive) + if (tds == kThemeStateInactive) bdi->state = kThemeStateActive; if (btn->state & QStyle::State_HasFocus) bdi->adornment = kThemeAdornmentFocus; @@ -1285,10 +1284,9 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem bdi->value = kThemeButtonOff; if (combo->state & QStyle::State_HasFocus) bdi->adornment = kThemeAdornmentFocus; - bool drawColorless = combo->palette.currentColorGroup() == QPalette::Active && tds == kThemeStateInactive; if (combo->activeSubControls & QStyle::SC_ComboBoxArrow) bdi->state = kThemeStatePressed; - else if (drawColorless) + else if (tds == kThemeStateInactive) bdi->state = kThemeStateActive; else bdi->state = tds; @@ -1609,8 +1607,6 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti tdi->enableState = (slider->state & QStyle::State_Enabled) ? kThemeTrackActive : kThemeTrackDisabled; - if (!(slider->state & QStyle::State_Active)) - tdi->enableState = kThemeTrackInactive; if (!isScrollbar) { if (slider->state & QStyle::QStyle::State_HasFocus) tdi->attributes |= kThemeTrackHasFocus; @@ -3031,12 +3027,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai case PE_IndicatorViewItemCheck: case PE_IndicatorRadioButton: case PE_IndicatorCheckBox: { - bool drawColorless = (!(opt->state & State_Active)) - && opt->palette.currentColorGroup() == QPalette::Active; + bool drawColorless = tds == kThemeStateInactive; HIThemeButtonDrawInfo bdi; bdi.version = qt_mac_hitheme_version; bdi.state = tds; - if (drawColorless && tds == kThemeStateInactive) + if (drawColorless) bdi.state = kThemeStateActive; bdi.adornment = kThemeDrawIndicatorOnly; if (opt->state & State_HasFocus) @@ -3570,13 +3565,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter int arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2; HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2); - bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active; - if (drawColorless && tds == kThemeStateInactive) - tds = kThemeStateActive; HIThemePopupArrowDrawInfo pdi; pdi.version = qt_mac_hitheme_version; - pdi.state = tds; + pdi.state = tds == kThemeStateInactive ? kThemeStateActive : tds; pdi.orientation = kThemeArrowDown; if (arrowRect.size.width < 8.) pdi.size = kThemeArrow5pt; @@ -5136,7 +5128,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex HIThemeFrameDrawInfo fdi; fdi.version = qt_mac_hitheme_version; - fdi.state = tds; + fdi.state = tds == kThemeStateInactive ? kThemeStateActive : tds; fdi.kind = kHIThemeFrameTextFieldSquare; fdi.isFocused = false; HIRect hirect = qt_hirectForQRect(lineeditRect); @@ -5167,11 +5159,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex else if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) tds = kThemeStatePressedUp; - bdi.state = tds; - if (!(sb->state & State_Active) - && sb->palette.currentColorGroup() == QPalette::Active - && tds == kThemeStateInactive) + if (tds == kThemeStateInactive) bdi.state = kThemeStateActive; + else + bdi.state = tds; bdi.value = kThemeButtonOff; bdi.adornment = kThemeAdornmentNone; @@ -5188,7 +5179,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex int(outRect.size.height - newRect.size.height)); newRect = qt_hirectForQRect(updown, off_rct); - HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); + if (tds == kThemeStateInactive) + d->drawColorlessButton(newRect, &bdi, p, sb); + else + HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); } } break; @@ -5196,8 +5190,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)){ HIThemeButtonDrawInfo bdi; d->initComboboxBdi(combo, &bdi, widget, d->getDrawState(opt->state)); - bool drawColorless = combo->palette.currentColorGroup() == QPalette::Active && tds == kThemeStateInactive; - if (!drawColorless) + if (!tds == kThemeStateInactive) QMacStylePrivate::drawCombobox(qt_hirectForQRect(combo->rect), bdi, p); else d->drawColorlessButton(qt_hirectForQRect(combo->rect), &bdi, p, opt); |