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>
This commit is contained in:
parent
475243a746
commit
d47a467ca6
@ -1937,6 +1937,15 @@ NSView *QMacStylePrivate::cocoaControl(QCocoaWidget widget) const
|
|||||||
|
|
||||||
if (!bv) {
|
if (!bv) {
|
||||||
switch (widget.first) {
|
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:
|
case QCocoaCheckBox:
|
||||||
bv = makeButton(NSSwitchButton, NSRegularSquareBezelStyle);
|
bv = makeButton(NSSwitchButton, NSRegularSquareBezelStyle);
|
||||||
break;
|
break;
|
||||||
@ -2089,7 +2098,7 @@ void QMacStylePrivate::drawNSViewInRect(QCocoaWidget widget, NSView *view, const
|
|||||||
|
|
||||||
CGContextTranslateCTM(ctx, offset.x(), offset.y());
|
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];
|
[backingStoreNSView addSubview:view];
|
||||||
view.frame = rect;
|
view.frame = rect;
|
||||||
@ -3257,17 +3266,13 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
|
|||||||
if (groupBox->features & QStyleOptionFrame::Flat) {
|
if (groupBox->features & QStyleOptionFrame::Flat) {
|
||||||
QCommonStyle::drawPrimitive(pe, groupBox, p, w);
|
QCommonStyle::drawPrimitive(pe, groupBox, p, w);
|
||||||
} else {
|
} else {
|
||||||
HIThemeGroupBoxDrawInfo gdi;
|
const auto cw = QCocoaWidget(QCocoaBox, QStyleHelper::SizeDefault);
|
||||||
gdi.version = qt_mac_hitheme_version;
|
auto *box = static_cast<NSBox *>(d->cocoaControl(cw));
|
||||||
gdi.state = tds;
|
d->drawNSViewInRect(cw, box, groupBox->rect, p, w != nullptr, ^(CGContextRef ctx, const CGRect &rect) {
|
||||||
#if QT_CONFIG(groupbox)
|
CGContextTranslateCTM(ctx, 0, rect.origin.y + rect.size.height);
|
||||||
if (w && qobject_cast<QGroupBox *>(w->parentWidget()))
|
CGContextScaleCTM(ctx, 1, -1);
|
||||||
gdi.kind = kHIThemeGroupBoxKindSecondary;
|
[box drawRect:rect];
|
||||||
else
|
});
|
||||||
#endif
|
|
||||||
gdi.kind = kHIThemeGroupBoxKindPrimary;
|
|
||||||
CGRect cgRect = opt->rect.toCGRect();
|
|
||||||
HIThemeDrawGroupBox(&cgRect, &gdi, cg, kHIThemeOrientationNormal);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -168,6 +168,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2))
|
#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2))
|
||||||
|
|
||||||
enum QCocoaWidgetKind {
|
enum QCocoaWidgetKind {
|
||||||
|
QCocoaBox, // QGroupBox
|
||||||
QCocoaCheckBox,
|
QCocoaCheckBox,
|
||||||
QCocoaComboBox, // Editable QComboBox
|
QCocoaComboBox, // Editable QComboBox
|
||||||
QCocoaDisclosureButton, // Disclosure triangle, like in QTreeView
|
QCocoaDisclosureButton, // Disclosure triangle, like in QTreeView
|
||||||
|
Loading…
x
Reference in New Issue
Block a user