From ee1868df2b6b60d59dff1a14fa2c16a9e759ef19 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 15 May 2017 13:28:21 -0700 Subject: QMacStyle: Remove a couple void *, dead code Change-Id: If05fbdf8cc5ced81adfd75232313969223bf1453 Reviewed-by: Jake Petroules --- src/plugins/styles/mac/qmacstyle_mac.mm | 22 +++++++++------------- src/plugins/styles/mac/qmacstyle_mac_p_p.h | 11 ++++------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index d4eb7141bd..43806381cc 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -1777,10 +1777,9 @@ void QMacStylePrivate::setAutoDefaultButton(QObject *button) const } QMacStylePrivate::QMacStylePrivate() - : mouseDown(false), backingStoreNSView(nil) + : backingStoreNSView(nil) { defaultButtonStart = CFAbsoluteTimeGetCurrent(); - memset(&buttonState, 0, sizeof(ButtonState)); } QMacStylePrivate::~QMacStylePrivate() @@ -2144,12 +2143,10 @@ QMacStyle::QMacStyle() QMacAutoReleasePool pool; d->receiver = [[NotificationReceiver alloc] initWithPrivate:d]; - NotificationReceiver *receiver = static_cast(d->receiver); - - [[NSNotificationCenter defaultCenter] addObserver:receiver - selector:@selector(scrollBarStyleDidChange:) - name:NSPreferredScrollerStyleDidChangeNotification - object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:d->receiver + selector:@selector(scrollBarStyleDidChange:) + name:NSPreferredScrollerStyleDidChangeNotification + object:nil]; d->indicatorBranchButtonCell = nil; } @@ -2159,9 +2156,8 @@ QMacStyle::~QMacStyle() Q_D(QMacStyle); QMacAutoReleasePool pool; - NotificationReceiver *receiver = static_cast(d->receiver); - [[NSNotificationCenter defaultCenter] removeObserver:receiver]; - [receiver release]; + [[NSNotificationCenter defaultCenter] removeObserver:d->receiver]; + [d->receiver release]; delete qt_mac_backgroundPattern; qt_mac_backgroundPattern = 0; @@ -3399,8 +3395,8 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai if (!(opt->state & State_Children)) break; if (!d->indicatorBranchButtonCell) - const_cast(d)->indicatorBranchButtonCell = (void *)[[NSButtonCell alloc] init]; - NSButtonCell *triangleCell = (NSButtonCell *)d->indicatorBranchButtonCell; + const_cast(d)->indicatorBranchButtonCell = [[NSButtonCell alloc] init]; + NSButtonCell *triangleCell = d->indicatorBranchButtonCell; [triangleCell setButtonType:NSOnOffButton]; [triangleCell setState:(opt->state & State_Open) ? NSOnState : NSOffState]; [triangleCell setBezelStyle:NSDisclosureBezelStyle]; diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 68d77deb06..f312adac52 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -118,6 +118,8 @@ Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGContext); Q_FORWARD_DECLARE_OBJC_CLASS(NSView); +Q_FORWARD_DECLARE_OBJC_CLASS(NSButtonCell); +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(NotificationReceiver)); QT_BEGIN_NAMESPACE @@ -244,15 +246,10 @@ public: mutable QPointer autoDefaultButton; static QVector > scrollBars; - struct ButtonState { - int frame; - enum { ButtonDark, ButtonLight } dir; - } buttonState; mutable QPointer focusWidget; CFAbsoluteTime defaultButtonStart; - bool mouseDown; - void* receiver; - void *indicatorBranchButtonCell; + QT_MANGLE_NAMESPACE(NotificationReceiver) *receiver; + NSButtonCell *indicatorBranchButtonCell; NSView *backingStoreNSView; QHash cocoaControls; }; -- cgit v1.2.3