7#include <QtCore/qrect.h>
8#include <QtCore/qline.h>
9#include <QtCore/qmutex.h>
10#include <QtCore/private/qlocking_p.h>
114 return p1.first <
p2.first;
159 for (
int i = 0;
i < keyValues.size(); ++
i) {
161 pair.second.convert(
type);
205 keyValues.constEnd(),
210 if (
it->first == 0 && keyValues.
size() > 1) {
219 if (
it->first == 1 && keyValues.
size() > 1) {
245 const qreal localProgress =
246 qIsNull(progress - startProgress) ? 0.0
247 : (progress - startProgress) / (endProgress - startProgress);
255 if (!changedSignalIndex.loadRelaxed()) {
257 changedSignalIndex.testAndSetRelaxed(0,
signalIndex(
"valueChanged(QVariant)"));
278 qWarning(
"QVariantAnimation::setValueAt: invalid step = %f", step);
285 if (
result == keyValues.end() ||
result->first != step) {
286 keyValues.insert(
result, pair);
358 d->recalculateCurrentInterval();
408 if (interpolationType >= interpolators->
size())
409 interpolators->
resize(interpolationType + 1);
426 if (interpolationType < interpolators->
size()) {
427 ret = interpolators->
at(interpolationType);
432 switch(interpolationType)
436 case QMetaType::UInt:
438 case QMetaType::Double:
440 case QMetaType::Float:
442 case QMetaType::QLine:
444 case QMetaType::QLineF:
446 case QMetaType::QPoint:
448 case QMetaType::QPointF:
450 case QMetaType::QSize:
452 case QMetaType::QSizeF:
454 case QMetaType::QRect:
456 case QMetaType::QRectF:
482 qWarning(
"QVariantAnimation::setDuration: cannot set a negative duration");
485 if (
d->duration == msecs) {
486 d->duration.removeBindingUnlessInWrapper();
490 d->recalculateCurrentInterval();
491 d->duration.notify();
549 return d_func()->valueAt(step);
571 d_func()->setValueAt(step,
value);
581 return d_func()->keyValues;
595 d->recalculateCurrentInterval(
true);
619 if (!
d->currentValue.isValid())
621 return d->currentValue;
672 d_func()->recalculateCurrentInterval();
677#include "moc_qvariantanimation.cpp"
State
This enum describes the state of the animation.
bool event(QEvent *event) override
\reimp
qreal valueForProgress(qreal progress) const
Return the effective progress for the easing curve at progress.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void replace(qsizetype i, parameter_type t)
void resize(qsizetype size)
bool isSignalConnected(uint signalIdx, bool checkDeclarative=true) const
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
QVariantAnimationPrivate()
void setCurrentValueForProgress(const qreal progress)
void updateInterpolator()
void recalculateCurrentInterval(bool force=false)
Q_OBJECT_COMPAT_PROPERTY(QVariantAnimationPrivate, int, duration, &QVariantAnimationPrivate::setDuration) QVariantAnimation QVariantAnimation::Interpolator interpolator
void setValueAt(qreal, const QVariant &)
struct QVariantAnimationPrivate::@3 currentInterval
QVariant valueAt(qreal step) const
void setDefaultStartEndValue(const QVariant &value)
static Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(int interpolationType)
void convertValues(int t)
QVariant defaultStartEndValue
int duration
the duration of the animation
KeyValues keyValues() const
Returns the key frames of this animation.
void setStartValue(const QVariant &value)
void setEasingCurve(const QEasingCurve &easing)
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override
\reimp
QVariant(* Interpolator)(const void *from, const void *to, qreal progress)
QEasingCurve easingCurve
the easing curve of the animation
QVariant currentValue
the current value of the animation.
virtual void updateCurrentValue(const QVariant &value)
This virtual function is called every time the animation's current value changes.
QVariant keyValueAt(qreal step) const
Returns the key frame value for the given step.
void setKeyValues(const KeyValues &values)
Replaces the current set of key frames with the given keyValues.
QPair< qreal, QVariant > KeyValue
This is a typedef for QPair<qreal, QVariant>.
void valueChanged(const QVariant &value)
QVariantAnimation emits this signal whenever the current value changes.
QVariantAnimation(QObject *parent=nullptr)
Construct a QVariantAnimation object.
QVariant startValue
the optional start value of the animation
QBindable< int > bindableDuration()
void updateCurrentTime(int) override
\reimp
void setDuration(int msecs)
virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const
This virtual function returns the linear interpolation between variants from and to,...
QVariant endValue
the end value of the animation
bool event(QEvent *event) override
\reimp
void setKeyValueAt(qreal step, const QVariant &value)
Creates a key frame at the given step with the given value.
QBindable< QEasingCurve > bindableEasingCurve()
~QVariantAnimation()
Destroys the animation.
void setEndValue(const QVariant &value)
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
const void * constData() const
QSet< QString >::iterator it
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qIsNull(qfloat16 f) noexcept
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
GLfixed GLfixed GLfixed y2
GLdouble GLdouble GLdouble GLdouble q
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble w1
constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
static double currentTime()
Q_INLINE_TEMPLATE QRect _q_interpolate(const QRect &f, const QRect &t, qreal progress)
static bool animationValueLessThan(const QVariantAnimation::KeyValue &p1, const QVariantAnimation::KeyValue &p2)
static QVariant defaultInterpolator(const void *, const void *, qreal)
static Q_CONSTINIT QBasicMutex registeredInterpolatorsMutex
static QVariantAnimation::Interpolator castToInterpolator(QVariant(*func)(const T &from, const T &to, qreal progress))
QList< QVariantAnimation::Interpolator > QInterpolatorVector
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent