QskAnimationHint::UpdateFlag introduced
This commit is contained in:
parent
a4a49bb7ae
commit
309106965d
@ -547,8 +547,11 @@ void QskSquiekSkin::initTabButtonHints()
|
|||||||
setTab( aspect );
|
setTab( aspect );
|
||||||
}
|
}
|
||||||
|
|
||||||
setAnimation( Q::Panel | Color, qskDuration );
|
QskAnimationHint animationHint( qskDuration );
|
||||||
setAnimation( Q::Panel | Metric, qskDuration );
|
animationHint.updateFlags = QskAnimationHint::UpdateNode;
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | Color, animationHint );
|
||||||
|
setAnimation( Q::Panel | Metric, animationHint );
|
||||||
|
|
||||||
// text
|
// text
|
||||||
setSkinHint( Q::Text | QskAspect::Alignment, Qt::AlignCenter );
|
setSkinHint( Q::Text | QskAspect::Alignment, Qt::AlignCenter );
|
||||||
|
@ -14,9 +14,23 @@
|
|||||||
class QSK_EXPORT QskAnimationHint
|
class QSK_EXPORT QskAnimationHint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum UpdateFlag
|
||||||
|
{
|
||||||
|
UpdateAuto = 0, // depending on the animated aspect
|
||||||
|
|
||||||
|
UpdateNode = 1 << 0,
|
||||||
|
UpdatePolish = 1 << 1,
|
||||||
|
UpdateSizeHint = 1 << 2,
|
||||||
|
|
||||||
|
UpdateAll = UpdateNode | UpdatePolish | UpdateSizeHint
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_FLAGS( UpdateFlags, UpdateFlag )
|
||||||
|
|
||||||
inline constexpr QskAnimationHint() noexcept
|
inline constexpr QskAnimationHint() noexcept
|
||||||
: duration( 0 )
|
: duration( 0 )
|
||||||
, type( QEasingCurve::Linear )
|
, type( QEasingCurve::Linear )
|
||||||
|
, updateFlags( UpdateAuto )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,14 +38,17 @@ class QSK_EXPORT QskAnimationHint
|
|||||||
QEasingCurve::Type type = QEasingCurve::Linear ) noexcept
|
QEasingCurve::Type type = QEasingCurve::Linear ) noexcept
|
||||||
: duration( duration )
|
: duration( duration )
|
||||||
, type( type )
|
, type( type )
|
||||||
|
, updateFlags( UpdateAuto )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
uint duration : 24;
|
uint duration;
|
||||||
QEasingCurve::Type type : 8;
|
QEasingCurve::Type type;
|
||||||
|
UpdateFlags updateFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE( QskAnimationHint )
|
Q_DECLARE_METATYPE( QskAnimationHint )
|
||||||
Q_DECLARE_TYPEINFO( QskAnimationHint, Q_PRIMITIVE_TYPE );
|
Q_DECLARE_TYPEINFO( QskAnimationHint, Q_PRIMITIVE_TYPE );
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS( QskAnimationHint::UpdateFlags )
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,6 +106,11 @@ void QskHintAnimator::setAspect( QskAspect::Aspect aspect )
|
|||||||
m_aspect = aspect;
|
m_aspect = aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskHintAnimator::setUpdateFlags( QskAnimationHint::UpdateFlags flags )
|
||||||
|
{
|
||||||
|
m_updateFlags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
void QskHintAnimator::setControl( QskControl* control )
|
void QskHintAnimator::setControl( QskControl* control )
|
||||||
{
|
{
|
||||||
m_control = control;
|
m_control = control;
|
||||||
@ -123,13 +128,29 @@ void QskHintAnimator::advance( qreal progress )
|
|||||||
|
|
||||||
if ( m_control && ( currentValue() != oldValue ) )
|
if ( m_control && ( currentValue() != oldValue ) )
|
||||||
{
|
{
|
||||||
if ( m_aspect.type() == QskAspect::Metric )
|
if ( m_updateFlags == QskAnimationHint::UpdateAuto )
|
||||||
{
|
{
|
||||||
m_control->resetImplicitSize();
|
if ( m_aspect.type() == QskAspect::Metric )
|
||||||
m_control->polish();
|
{
|
||||||
}
|
m_control->resetImplicitSize();
|
||||||
|
|
||||||
m_control->update();
|
if ( !m_control->childItems().isEmpty() )
|
||||||
|
m_control->polish();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_control->update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( m_updateFlags & QskAnimationHint::UpdateSizeHint )
|
||||||
|
m_control->resetImplicitSize();
|
||||||
|
|
||||||
|
if ( m_updateFlags & QskAnimationHint::UpdatePolish )
|
||||||
|
m_control->polish();
|
||||||
|
|
||||||
|
if ( m_updateFlags & QskAnimationHint::UpdateNode )
|
||||||
|
m_control->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,6 +240,7 @@ void QskHintAnimatorTable::start( QskControl* control,
|
|||||||
|
|
||||||
animator.setDuration( animationHint.duration );
|
animator.setDuration( animationHint.duration );
|
||||||
animator.setEasingCurve( animationHint.type );
|
animator.setEasingCurve( animationHint.type );
|
||||||
|
animator.setUpdateFlags( animationHint.updateFlags );
|
||||||
|
|
||||||
animator.setControl( control );
|
animator.setControl( control );
|
||||||
animator.setWindow( control->window() );
|
animator.setWindow( control->window() );
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
#include "QskAspect.h"
|
#include "QskAspect.h"
|
||||||
#include "QskVariantAnimator.h"
|
#include "QskVariantAnimator.h"
|
||||||
|
#include "QskAnimationHint.h"
|
||||||
|
|
||||||
#include <qpointer.h>
|
#include <qpointer.h>
|
||||||
|
|
||||||
class QskControl;
|
class QskControl;
|
||||||
class QskAnimationHint;
|
|
||||||
|
|
||||||
class QSK_EXPORT QskHintAnimator : public QskVariantAnimator
|
class QSK_EXPORT QskHintAnimator : public QskVariantAnimator
|
||||||
{
|
{
|
||||||
@ -28,10 +28,14 @@ class QSK_EXPORT QskHintAnimator : public QskVariantAnimator
|
|||||||
void setControl( QskControl* );
|
void setControl( QskControl* );
|
||||||
QskControl* control() const;
|
QskControl* control() const;
|
||||||
|
|
||||||
|
void setUpdateFlags( QskAnimationHint::UpdateFlags );
|
||||||
|
QskAnimationHint::UpdateFlags updateFlags() const;
|
||||||
|
|
||||||
void advance( qreal value ) override;
|
void advance( qreal value ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QskAspect::Aspect m_aspect;
|
QskAspect::Aspect m_aspect;
|
||||||
|
QskAnimationHint::UpdateFlags m_updateFlags;
|
||||||
QPointer< QskControl > m_control;
|
QPointer< QskControl > m_control;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,6 +65,11 @@ inline QskAspect::Aspect QskHintAnimator::aspect() const
|
|||||||
return m_aspect;
|
return m_aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline QskAnimationHint::UpdateFlags QskHintAnimator::updateFlags() const
|
||||||
|
{
|
||||||
|
return m_updateFlags;
|
||||||
|
}
|
||||||
|
|
||||||
inline QskControl* QskHintAnimator::control() const
|
inline QskControl* QskHintAnimator::control() const
|
||||||
{
|
{
|
||||||
return m_control;
|
return m_control;
|
||||||
|
@ -384,6 +384,7 @@ namespace
|
|||||||
|
|
||||||
animator.setDuration( animationHint.duration );
|
animator.setDuration( animationHint.duration );
|
||||||
animator.setEasingCurve( animationHint.type );
|
animator.setEasingCurve( animationHint.type );
|
||||||
|
animator.setUpdateFlags( animationHint.updateFlags );
|
||||||
|
|
||||||
animator.setControl( nullptr );
|
animator.setControl( nullptr );
|
||||||
animator.setWindow( window );
|
animator.setWindow( window );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user