summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-09-05 16:27:36 -0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-10-03 21:12:36 +0000
commitd47a467ca6d2457f7ae5c9f53857596dd4455974 (patch)
tree01922787953439bca4aa9aeb8de9ee7a0aa25eef /src/plugins/styles
parent475243a746461b44cd26c30785b59cfd8fe79aaf (diff)
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 <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm29
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac_p_p.h1
2 files changed, 18 insertions, 12 deletions
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<QGroupBox *>(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<NSBox *>(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