Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qvariantanimation.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QVARIANTANIMATION_H
5#define QVARIANTANIMATION_H
6
7#include <QtCore/qabstractanimation.h>
8#include <QtCore/qeasingcurve.h>
9#include <QtCore/qlist.h>
10#include <QtCore/qpair.h>
11#include <QtCore/qvariant.h>
12
14
16
18class Q_CORE_EXPORT QVariantAnimation : public QAbstractAnimation
19{
21 Q_PROPERTY(QVariant startValue READ startValue WRITE setStartValue)
22 Q_PROPERTY(QVariant endValue READ endValue WRITE setEndValue)
23 Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY valueChanged)
24 Q_PROPERTY(int duration READ duration WRITE setDuration BINDABLE bindableDuration)
25 Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve
26 BINDABLE bindableEasingCurve)
27
28public:
31
34
35 QVariant startValue() const;
36 void setStartValue(const QVariant &value);
37
38 QVariant endValue() const;
39 void setEndValue(const QVariant &value);
40
41 QVariant keyValueAt(qreal step) const;
42 void setKeyValueAt(qreal step, const QVariant &value);
43
44 KeyValues keyValues() const;
45 void setKeyValues(const KeyValues &values);
46
47 QVariant currentValue() const;
48
49 int duration() const override;
50 void setDuration(int msecs);
51 QBindable<int> bindableDuration();
52
53 QEasingCurve easingCurve() const;
55 QBindable<QEasingCurve> bindableEasingCurve();
56
57 typedef QVariant (*Interpolator)(const void *from, const void *to, qreal progress);
58
61
62protected:
64 bool event(QEvent *event) override;
65
66 void updateCurrentTime(int) override;
68
69 virtual void updateCurrentValue(const QVariant &value);
70 virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
71
72private:
73 template <typename T> friend void qRegisterAnimationInterpolator(QVariant (*func)(const T &, const T &, qreal));
74 static void registerInterpolator(Interpolator func, int interpolationType);
75
76 Q_DISABLE_COPY(QVariantAnimation)
77 Q_DECLARE_PRIVATE(QVariantAnimation)
78};
79
80template <typename T>
81void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) {
82 QVariantAnimation::registerInterpolator(reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void(*)()>(func)), qMetaTypeId<T>());
83}
84
86
87#endif //QVARIANTANIMATION_H
State
This enum describes the state of the animation.
virtual void updateCurrentTime(int currentTime)=0
This pure virtual function is called every time the animation's currentTime changes.
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
This virtual function is called by QAbstractAnimation when the state of the animation is changed from...
int duration
the duration of the animation.
\inmodule QtCore
Definition qproperty.h:809
\inmodule QtCore
\inmodule QtCore
Definition qcoreevent.h:45
Definition qlist.h:74
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
QVariant(* Interpolator)(const void *from, const void *to, qreal progress)
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.
friend void qRegisterAnimationInterpolator(QVariant(*func)(const T &, const T &, qreal))
QList< KeyValue > KeyValues
This is a typedef for QList<KeyValue>
\inmodule QtCore
Definition qvariant.h:64
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
std::pair< T1, T2 > QPair
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLsizei GLsizei GLint * values
[15]
struct _cl_event * event
GLenum func
Definition qopenglext.h:663
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SIGNALS
double qreal
Definition qtypes.h:92
void qRegisterAnimationInterpolator(QVariant(*func)(const T &from, const T &to, qreal progress))
QEasingCurve easing(QEasingCurve::InOutQuad)
[typedef]
QPropertyAnimation animation
[0]
animation setStartValue(0)
animation setEndValue(1000)
animation setEasingCurve(QEasingCurve::InOutQuad)
animation setDuration(1000)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent