Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qvariantanimation_p.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_P_H
5#define QVARIANTANIMATION_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qvariantanimation.h"
19#include <QtCore/qeasingcurve.h>
20#include <QtCore/qmetaobject.h>
21
22#include "private/qabstractanimation_p.h"
23#include "private/qproperty_p.h"
24
25#include <type_traits>
26
28
30
32{
33 Q_DECLARE_PUBLIC(QVariantAnimation)
34public:
35
37
39 {
40 return q->d_func();
41 }
42
44
45
48
49 //this is used to keep track of the KeyValue interval in which we currently are
50 struct
51 {
54
55 void setEasingCurve(const QEasingCurve &easing) { q_func()->setEasingCurve(easing); }
61 &QVariantAnimationPrivate::setDuration)
62
65
66 void setCurrentValueForProgress(const qreal progress);
67 void recalculateCurrentInterval(bool force=false);
68 void setValueAt(qreal, const QVariant &);
69 QVariant valueAt(qreal step) const;
70 void convertValues(int t);
71
72 void updateInterpolator();
73
74 //XXX this is needed by dui
75 static Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(int interpolationType);
76};
77
78//this should make the interpolation faster
79template<typename T>
80typename std::enable_if<std::is_unsigned<T>::value, T>::type
81_q_interpolate(const T &f, const T &t, qreal progress)
82{
83 return T(f + t * progress - f * progress);
84}
85
86// the below will apply also to all non-arithmetic types
87template<typename T>
88typename std::enable_if<!std::is_unsigned<T>::value, T>::type
89_q_interpolate(const T &f, const T &t, qreal progress)
90{
91 return T(f + (t - f) * progress);
92}
93
94template<typename T > inline QVariant _q_interpolateVariant(const T &from, const T &to, qreal progress)
95{
96 return _q_interpolate(from, to, progress);
97}
98
99
101
102#endif //QVARIANTANIMATION_P_H
\inmodule QtCore
Definition qlist.h:75
void setCurrentValueForProgress(const qreal progress)
static QVariantAnimationPrivate * get(QVariantAnimation *q)
Q_OBJECT_COMPAT_PROPERTY(QVariantAnimationPrivate, QEasingCurve, easing, &QVariantAnimationPrivate::setEasingCurve) void setDuration(int msecs)
Q_OBJECT_COMPAT_PROPERTY(QVariantAnimationPrivate, int, duration, &QVariantAnimationPrivate::setDuration) QVariantAnimation QVariantAnimation::Interpolato interpolator)
void recalculateCurrentInterval(bool force=false)
void setValueAt(qreal, const QVariant &)
struct QVariantAnimationPrivate::@3 currentInterval
QVariantAnimation::KeyValue start
QVariantAnimation::KeyValue end
QVariant valueAt(qreal step) const
void setDefaultStartEndValue(const QVariant &value)
void setEasingCurve(const QEasingCurve &easing)
static Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(int interpolationType)
\inmodule QtCore
QVariant(* Interpolator)(const void *from, const void *to, qreal progress)
std::pair< qreal, QVariant > KeyValue
This is a typedef for std::pair<qreal, QVariant>.
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLfloat GLfloat f
GLenum type
GLdouble GLdouble t
Definition qopenglext.h:243
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
#define Q_OBJECT_COMPAT_PROPERTY(...)
#define QT_REQUIRE_CONFIG(feature)
double qreal
Definition qtypes.h:187
QVariant _q_interpolateVariant(const T &from, const T &to, qreal progress)
std::enable_if< std::is_unsigned< T >::value, T >::type _q_interpolate(const T &f, const T &t, qreal progress)
QEasingCurve easing(QEasingCurve::InOutQuad)
[typedef]
QPropertyAnimation animation
[0]
animation setDuration(1000)