diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-05-15 16:08:34 -0700 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-05-16 17:03:46 +0000 |
commit | 6775cfa05491a743230ba67c17d45b238bfd900a (patch) | |
tree | 14e827c5ce19aa5581e9947b3e031ec25055b9ad /src/plugins/styles | |
parent | 904788e3c6e800e4a8b641b549cbfd86f2045f80 (diff) |
QMacStyle: Remove unused default button logic
The auto-default button part must remain, but the pulsating
animation logic can go. Same for the pressed button logic.
Change-Id: I0e9a755f86601780a219296fbc02a1eb2b703aea
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 49 | ||||
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac_p_p.h | 4 |
2 files changed, 6 insertions, 47 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index d8c40ac156..7124f1a468 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -1763,24 +1763,9 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti } } -void QMacStylePrivate::setAutoDefaultButton(QObject *button) const -{ - if (autoDefaultButton != button) { - if (QStyleAnimation *anim = animation(autoDefaultButton)) { - anim->updateTarget(); - stopAnimation(autoDefaultButton); - } - autoDefaultButton = button; - } - if (autoDefaultButton && !animation(autoDefaultButton)) - startAnimation(new QStyleAnimation(autoDefaultButton)); -} - QMacStylePrivate::QMacStylePrivate() : backingStoreNSView(nil) -{ - defaultButtonStart = CFAbsoluteTimeGetCurrent(); -} +{ } QMacStylePrivate::~QMacStylePrivate() { @@ -3826,36 +3811,14 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter break; } - // No default button pulsating animation on Yosemite, - // so we have to do few things differently. - // a focused auto-default button within an active window // takes precedence over a normal default button - if (btn->features & QStyleOptionButton::AutoDefaultButton - && opt->state & State_Active && opt->state & State_HasFocus) { + if ((btn->features & QStyleOptionButton::AutoDefaultButton) + && (opt->state & State_Active) + && (opt->state & State_HasFocus)) d->autoDefaultButton = opt->styleObject; - } else if (d->autoDefaultButton == opt->styleObject) { - d->setAutoDefaultButton(0); - } - - if (!d->autoDefaultButton) { - if (btn->features & QStyleOptionButton::DefaultButton && opt->state & State_Active) { - d->defaultButton = opt->styleObject; - } else if (d->defaultButton == opt->styleObject) { - if (QStyleAnimation *animation = d->animation(opt->styleObject)) { - animation->updateTarget(); - d->stopAnimation(opt->styleObject); - } - d->defaultButton = 0; - } - } - - // TODO: find out the pressed button in a qwidget independent way - extern QWidget *qt_button_down; // qwidgetwindow.cpp - if (opt->styleObject == qt_button_down) - d->pressedButton = opt->styleObject; - else if (d->pressedButton == opt->styleObject) - d->pressedButton = 0; + else if (d->autoDefaultButton == opt->styleObject) + d->autoDefaultButton = nullptr; bool hasMenu = btn->features & QStyleOptionButton::HasMenu; HIThemeButtonDrawInfo bdi; diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 704627cd7b..2c701713c8 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -119,7 +119,6 @@ Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGContext); Q_FORWARD_DECLARE_OBJC_CLASS(NSView); Q_FORWARD_DECLARE_OBJC_CLASS(NSCell); -Q_FORWARD_DECLARE_OBJC_CLASS(NSButtonCell); Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(NotificationReceiver)); QT_BEGIN_NAMESPACE @@ -244,13 +243,10 @@ public: #endif public: - mutable QPointer<QObject> pressedButton; - mutable QPointer<QObject> defaultButton; mutable QPointer<QObject> autoDefaultButton; static QVector<QPointer<QObject> > scrollBars; mutable QPointer<QFocusFrame> focusWidget; - CFAbsoluteTime defaultButtonStart; QT_MANGLE_NAMESPACE(NotificationReceiver) *receiver; NSView *backingStoreNSView; QHash<QCocoaWidget, NSView *> cocoaControls; |