diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-05-15 14:47:30 -0700 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-05-15 22:40:28 +0000 |
commit | 92a07c6289b3d0a0ac1a19346782d701faa8b50a (patch) | |
tree | 96510877173aec047b4c1b921a0dea623495392e /src/plugins/styles | |
parent | 6f3b59bfe4d22f8c717f1727816d3f8e775996be (diff) |
QMacStyle: Move disclosure triangle into cocoaCell() logic
Change-Id: Ica7766dabba57af3107ea275aa48514bc65158fb
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 19 | ||||
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac_p_p.h | 3 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 003d050448..d8c40ac156 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -1822,7 +1822,7 @@ static QCocoaWidget cocoaWidgetFromHIThemeButtonKind(ThemeButtonKind kind) w.first = QCocoaComboBox; break; case kThemeArrowButton: - w.first = QCocoaArrowButton; + w.first = QCocoaDisclosureButton; break; case kThemeCheckBox: case kThemeCheckBoxSmall: @@ -1890,7 +1890,7 @@ NSView *QMacStylePrivate::cocoaControl(QCocoaWidget widget) const bv = [[NSButton alloc] init]; switch (widget.first) { - case QCocoaArrowButton: { + case QCocoaDisclosureButton: { NSButton *bc = (NSButton *)bv; bc.buttonType = NSOnOffButton; bc.bezelStyle = NSDisclosureBezelStyle; @@ -1954,6 +1954,13 @@ NSCell *QMacStylePrivate::cocoaCell(QCocoaWidget widget) const case QCocoaStepper: cell = [[NSStepperCell alloc] init]; break; + case QCocoaDisclosureButton: { + NSButtonCell *bc = [[NSButtonCell alloc] init]; + bc.buttonType = NSOnOffButton; + bc.bezelStyle = NSDisclosureBezelStyle; + cell = bc; + break; + } default: break; } @@ -2178,8 +2185,6 @@ QMacStyle::QMacStyle() selector:@selector(scrollBarStyleDidChange:) name:NSPreferredScrollerStyleDidChangeNotification object:nil]; - - d->indicatorBranchButtonCell = nil; } QMacStyle::~QMacStyle() @@ -3425,12 +3430,8 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai case PE_IndicatorBranch: { if (!(opt->state & State_Children)) break; - if (!d->indicatorBranchButtonCell) - const_cast<QMacStylePrivate *>(d)->indicatorBranchButtonCell = [[NSButtonCell alloc] init]; - NSButtonCell *triangleCell = d->indicatorBranchButtonCell; - [triangleCell setButtonType:NSOnOffButton]; + NSButtonCell *triangleCell = static_cast<NSButtonCell *>(d->cocoaCell(QCocoaWidget(QCocoaDisclosureButton, QStyleHelper::SizeLarge))); [triangleCell setState:(opt->state & State_Open) ? NSOnState : NSOffState]; - [triangleCell setBezelStyle:NSDisclosureBezelStyle]; bool viewHasFocus = (w && w->hasFocus()) || (opt->state & State_HasFocus); [triangleCell setBackgroundStyle:((opt->state & State_Selected) && viewHasFocus) ? NSBackgroundStyleDark : NSBackgroundStyleLight]; diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 3aacd14e60..704627cd7b 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -138,9 +138,9 @@ QT_BEGIN_NAMESPACE #define CT2(c1, c2) ((uint(c1) << 16) | uint(c2)) enum QCocoaWidgetKind { - QCocoaArrowButton, // Disclosure triangle, like in QTreeView QCocoaCheckBox, QCocoaComboBox, // Editable QComboBox + QCocoaDisclosureButton, // Disclosure triangle, like in QTreeView QCocoaPopupButton, // Non-editable QComboBox QCocoaPullDownButton, // QPushButton with menu QCocoaPushButton, @@ -252,7 +252,6 @@ public: mutable QPointer<QFocusFrame> focusWidget; CFAbsoluteTime defaultButtonStart; QT_MANGLE_NAMESPACE(NotificationReceiver) *receiver; - NSButtonCell *indicatorBranchButtonCell; NSView *backingStoreNSView; QHash<QCocoaWidget, NSView *> cocoaControls; QHash<QCocoaWidget, NSCell *> cocoaCells; |