stop animation, when start/endValues are chaged. Otherwise we will run
into crashes, when value types have not been aligned or can't be aligned
This commit is contained in:
parent
6728ad2bdc
commit
f4a9b15f11
|
@ -53,13 +53,13 @@ Q_CONSTRUCTOR_FUNCTION( qskRegisterInterpolator )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( Q_CC_CLANG )
|
#if defined( Q_CC_CLANG )
|
||||||
#if __has_feature( address_sanitizer )
|
#if __has_feature( address_sanitizer )
|
||||||
#define QSK_DECL_INSANE __attribute__( ( no_sanitize( "undefined" ) ) )
|
#define QSK_DECL_INSANE __attribute__( ( no_sanitize( "undefined" ) ) )
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined( QSK_DECL_INSANE )
|
#if !defined( QSK_DECL_INSANE )
|
||||||
#define QSK_DECL_INSANE
|
#define QSK_DECL_INSANE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QSK_DECL_INSANE static inline QVariant qskInterpolate(
|
QSK_DECL_INSANE static inline QVariant qskInterpolate(
|
||||||
|
@ -112,11 +112,13 @@ QskVariantAnimator::~QskVariantAnimator()
|
||||||
|
|
||||||
void QskVariantAnimator::setStartValue( const QVariant& value )
|
void QskVariantAnimator::setStartValue( const QVariant& value )
|
||||||
{
|
{
|
||||||
|
stop();
|
||||||
m_startValue = value;
|
m_startValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskVariantAnimator::setEndValue( const QVariant& value )
|
void QskVariantAnimator::setEndValue( const QVariant& value )
|
||||||
{
|
{
|
||||||
|
stop();
|
||||||
m_endValue = value;
|
m_endValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +173,7 @@ void QskVariantAnimator::setup()
|
||||||
|
|
||||||
if ( convertValues( m_startValue, m_endValue ) )
|
if ( convertValues( m_startValue, m_endValue ) )
|
||||||
{
|
{
|
||||||
if ( m_startValue != m_endValue )
|
if ( m_startValue != m_endValue )
|
||||||
{
|
{
|
||||||
const auto id = m_startValue.userType();
|
const auto id = m_startValue.userType();
|
||||||
|
|
||||||
|
@ -191,6 +193,8 @@ void QskVariantAnimator::advance( qreal progress )
|
||||||
if ( qFuzzyCompare( progress, 1.0 ) )
|
if ( qFuzzyCompare( progress, 1.0 ) )
|
||||||
progress = 1.0;
|
progress = 1.0;
|
||||||
|
|
||||||
|
Q_ASSERT( qskMetaType( m_startValue ) == qskMetaType( m_endValue ) );
|
||||||
|
|
||||||
m_currentValue = qskInterpolate( m_interpolator,
|
m_currentValue = qskInterpolate( m_interpolator,
|
||||||
m_startValue, m_endValue, progress );
|
m_startValue, m_endValue, progress );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue