QMacStyle: Move disclosure triangle into cocoaCell() logic
Change-Id: Ica7766dabba57af3107ea275aa48514bc65158fb Reviewed-by: Jake Petroules <jake.petroules@qt.io>bb10
parent
6f3b59bfe4
commit
92a07c6289
|
|
@ -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];
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue