From d47a467ca6d2457f7ae5c9f53857596dd4455974 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 5 Sep 2017 16:27:36 -0700 Subject: QMacStyle: De-HITheme QGroupBox NSBox is good enough for this and pixel equivalent with the previous HITheme calls. Change-Id: I32b2a1cc8a9cd2a6ef17d1e01032540344808ebc Reviewed-by: Jake Petroules --- src/plugins/styles/mac/qmacstyle_mac.mm | 29 +++++++++++++++++------------ src/plugins/styles/mac/qmacstyle_mac_p_p.h | 1 + 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 271a2d43e5..281f5affed 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -1937,6 +1937,15 @@ NSView *QMacStylePrivate::cocoaControl(QCocoaWidget widget) const if (!bv) { switch (widget.first) { + case QCocoaBox: { + NSBox *bc = [[NSBox alloc] init]; + bc.title = @""; + bc.titlePosition = NSNoTitle; + bc.boxType = NSBoxPrimary; + bc.borderType = NSBezelBorder; + bv = bc; + break; + } case QCocoaCheckBox: bv = makeButton(NSSwitchButton, NSRegularSquareBezelStyle); break; @@ -2089,7 +2098,7 @@ void QMacStylePrivate::drawNSViewInRect(QCocoaWidget widget, NSView *view, const CGContextTranslateCTM(ctx, offset.x(), offset.y()); - const CGRect rect = CGRectMake(qtRect.x() + 1, qtRect.y(), qtRect.width(), qtRect.height()); + const CGRect rect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height()); [backingStoreNSView addSubview:view]; view.frame = rect; @@ -3257,17 +3266,13 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai if (groupBox->features & QStyleOptionFrame::Flat) { QCommonStyle::drawPrimitive(pe, groupBox, p, w); } else { - HIThemeGroupBoxDrawInfo gdi; - gdi.version = qt_mac_hitheme_version; - gdi.state = tds; -#if QT_CONFIG(groupbox) - if (w && qobject_cast(w->parentWidget())) - gdi.kind = kHIThemeGroupBoxKindSecondary; - else -#endif - gdi.kind = kHIThemeGroupBoxKindPrimary; - CGRect cgRect = opt->rect.toCGRect(); - HIThemeDrawGroupBox(&cgRect, &gdi, cg, kHIThemeOrientationNormal); + const auto cw = QCocoaWidget(QCocoaBox, QStyleHelper::SizeDefault); + auto *box = static_cast(d->cocoaControl(cw)); + d->drawNSViewInRect(cw, box, groupBox->rect, p, w != nullptr, ^(CGContextRef ctx, const CGRect &rect) { + CGContextTranslateCTM(ctx, 0, rect.origin.y + rect.size.height); + CGContextScaleCTM(ctx, 1, -1); + [box drawRect:rect]; + }); } } break; diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index e65c78a61a..528edfcda1 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -168,6 +168,7 @@ QT_BEGIN_NAMESPACE #define CT2(c1, c2) ((uint(c1) << 16) | uint(c2)) enum QCocoaWidgetKind { + QCocoaBox, // QGroupBox QCocoaCheckBox, QCocoaComboBox, // Editable QComboBox QCocoaDisclosureButton, // Disclosure triangle, like in QTreeView -- cgit v1.2.3