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>bb10
parent
904788e3c6
commit
6775cfa054
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue