using built in QskHintAnimators
This commit is contained in:
parent
0a6ed7deb1
commit
0390166783
@ -5,7 +5,6 @@
|
||||
|
||||
#include "QskPushButton.h"
|
||||
#include "QskAnimationHint.h"
|
||||
#include "QskAnimator.h"
|
||||
#include "QskAspect.h"
|
||||
#include "QskBoxShapeMetrics.h"
|
||||
#include "QskGraphic.h"
|
||||
@ -22,37 +21,6 @@ QSK_SUBCONTROL( QskPushButton, Ripple )
|
||||
QSK_SUBCONTROL( QskPushButton, Text )
|
||||
QSK_SUBCONTROL( QskPushButton, Graphic )
|
||||
|
||||
namespace
|
||||
{
|
||||
class ClickAnimator : public QskAnimator
|
||||
{
|
||||
public:
|
||||
ClickAnimator()
|
||||
: QskAnimator()
|
||||
{
|
||||
}
|
||||
|
||||
void setButton( QskPushButton* button )
|
||||
{
|
||||
m_button = button;
|
||||
}
|
||||
|
||||
protected:
|
||||
void advance( qreal value ) override
|
||||
{
|
||||
m_button->setMetric( QskPushButton::Ripple | QskAspect::Size, value );
|
||||
}
|
||||
|
||||
void done() override
|
||||
{
|
||||
m_button->setMetric( QskPushButton::Ripple | QskAspect::Size, 0.0 );
|
||||
}
|
||||
|
||||
private:
|
||||
QskPushButton* m_button;
|
||||
};
|
||||
}
|
||||
|
||||
class QskPushButton::PrivateData
|
||||
{
|
||||
public:
|
||||
@ -83,9 +51,6 @@ class QskPushButton::PrivateData
|
||||
|
||||
QSizeF graphicSourceSize;
|
||||
|
||||
ClickAnimator clickAnimator;
|
||||
qreal rippleSize = 0.0;
|
||||
|
||||
bool isCheckable : 1;
|
||||
bool isGraphicSourceDirty : 1;
|
||||
};
|
||||
@ -314,17 +279,13 @@ void QskPushButton::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
Inherited::mousePressEvent( event );
|
||||
|
||||
const auto hint = animationHint( Ripple | QskAspect::Color );
|
||||
using A = QskAspect;
|
||||
|
||||
const auto hint = animationHint( Ripple | A::Color );
|
||||
if( hint.isValid() )
|
||||
{
|
||||
setSkinHint( Ripple | QskAspect::Metric | QskAspect::Position, event->pos() );
|
||||
|
||||
m_data->clickAnimator.setWindow( window() );
|
||||
m_data->clickAnimator.setButton( this );
|
||||
m_data->clickAnimator.setDuration( hint.duration );
|
||||
m_data->clickAnimator.setEasingCurve( hint.type );
|
||||
m_data->clickAnimator.start();
|
||||
setSkinHint( Ripple | A::Metric | A::Position, event->pos() );
|
||||
startTransition( Ripple | A::Metric | A::Size, hint, 0.0, 1.0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user