diff options
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac.mm')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index eefacc4864..1ea0e27418 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1205,7 +1205,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; @@ -1213,7 +1212,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; @@ -1284,10 +1283,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; @@ -1608,8 +1606,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; @@ -3027,12 +3023,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) @@ -3554,13 +3549,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; @@ -3991,7 +3983,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter HIRect cr; bool needAlpha = mi->palette.color(QPalette::Button) == Qt::transparent; if (needAlpha) { - needAlpha = true; CGContextSaveGState(cg); CGContextSetAlpha(cg, 0.0); } @@ -5118,7 +5109,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); @@ -5149,11 +5140,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; @@ -5170,7 +5160,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; @@ -5178,8 +5171,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); @@ -6539,15 +6531,16 @@ QMacCGContext::QMacCGContext(QPainter *p) context = CGBitmapContextCreate((void *) image->bits(), image->width(), image->height(), 8, image->bytesPerLine(), colorspace, flags); + // Invert y axis. CGContextTranslateCTM(context, 0, image->height()); CGContextScaleCTM(context, 1, -1); + const qreal devicePixelRatio = image->devicePixelRatio(); + if (devType == QInternal::Widget) { // Set the clip rect which is an intersection of the system clip // and the painter clip. To make matters more interesting these // are in device pixels and device-independent pixels, respectively. - const qreal devicePixelRatio = image->devicePixelRatio(); - QRegion clip = p->paintEngine()->systemClip(); // get system clip in device pixels QTransform native = p->deviceTransform(); // get device transform. dx/dy is in device pixels @@ -6565,6 +6558,9 @@ QMacCGContext::QMacCGContext(QPainter *p) // Scale the context so that painting happens in device-independet pixels. CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio); CGContextTranslateCTM(context, native.dx() / devicePixelRatio, native.dy() / devicePixelRatio); + } else { + // Scale to paint in device-independent pixels. + CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio); } } else { qDebug() << "QMacCGContext:: Unsupported painter devtype type" << devType; |