Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QVARIANTANIMATION_P_H
6
#
define
QVARIANTANIMATION_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
"qvariantanimation.h"
20
#
include
<
QtCore
/
qeasingcurve
.
h
>
21
#
include
<
QtCore
/
qmetaobject
.
h
>
22
23
#
include
"private/qabstractanimation_p.h"
24
#
include
"private/qproperty_p.h"
25
26
#
include
<
type_traits
>
27
28
QT_REQUIRE_CONFIG
(
animation
);
29
30
QT_BEGIN_NAMESPACE
31
32
class
QVariantAnimationPrivate :
public
QAbstractAnimationPrivate
33
{
34
Q_DECLARE_PUBLIC(QVariantAnimation)
35
public
:
36
37
QVariantAnimationPrivate();
38
~QVariantAnimationPrivate() override;
39
40
static
QVariantAnimationPrivate *get(QVariantAnimation *q)
41
{
42
return
q->d_func();
43
}
44
45
void
setDefaultStartEndValue(
const
QVariant &value);
46
47
48
QVariant currentValue;
49
QVariant defaultStartEndValue;
50
51
//this is used to keep track of the KeyValue interval in which we currently are
52
struct
53
{
54
QVariantAnimation::KeyValue start, end;
55
} currentInterval;
56
57
void
setEasingCurve(
const
QEasingCurve &easing) { q_func()->setEasingCurve(easing); }
58
Q_OBJECT_COMPAT_PROPERTY(QVariantAnimationPrivate, QEasingCurve, easing,
59
&QVariantAnimationPrivate::setEasingCurve)
60
61
void
setDuration(
int
msecs) { q_func()->setDuration(msecs); }
62
Q_OBJECT_COMPAT_PROPERTY(QVariantAnimationPrivate,
int
, duration,
63
&QVariantAnimationPrivate::setDuration)
64
65
QVariantAnimation::KeyValues keyValues;
66
QVariantAnimation::Interpolator interpolator;
67
68
void
setCurrentValueForProgress(
const
qreal progress);
69
void
recalculateCurrentInterval(
bool
force=
false
);
70
void
setValueAt(qreal,
const
QVariant &);
71
QVariant valueAt(qreal step)
const
;
72
void
convertValues(
int
t);
73
74
void
updateInterpolator();
75
76
//XXX this is needed by dui
77
static
Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(
int
interpolationType);
78
};
79
80
//this should make the interpolation faster
81
template
<
typename
T>
82
typename
std
::enable_if<
std
::is_unsigned<T>::value, T>::
type
83
_q_interpolate
(
const
T &f,
const
T &t, qreal progress)
84
{
85
return
T(f + t * progress - f * progress);
86
}
87
88
// the below will apply also to all non-arithmetic types
89
template
<
typename
T>
90
typename
std
::enable_if<!
std
::is_unsigned<T>::value, T>::
type
91
_q_interpolate
(
const
T &f,
const
T &t, qreal progress)
92
{
93
return
T(f + (t - f) * progress);
94
}
95
96
template
<
typename
T >
inline
QVariant
_q_interpolateVariant
(
const
T &from,
const
T &to, qreal progress)
97
{
98
return
_q_interpolate(from, to, progress);
99
}
100
101
102
QT_END_NAMESPACE
103
104
#
endif
//QVARIANTANIMATION_P_H
QLineF
\inmodule QtCore\compares equality \compareswith equality QLine \endcompareswith
Definition
qline.h:194
QLine
\inmodule QtCore\compares equality \compareswith equality QLineF \endcompareswith
Definition
qline.h:20
QRectF
\inmodule QtCore\reentrant
Definition
qrect.h:510
QRect
\inmodule QtCore\reentrant
Definition
qrect.h:32
QVariantAnimation
\inmodule QtCore
Definition
qvariantanimation.h:20
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(animation)
animationValueLessThan
static bool animationValueLessThan(const QVariantAnimation::KeyValue &p1, const QVariantAnimation::KeyValue &p2)
Definition
qvariantanimation.cpp:113
defaultInterpolator
static QVariant defaultInterpolator(const void *, const void *, qreal)
Definition
qvariantanimation.cpp:118
QInterpolatorVector
QList< QVariantAnimation::Interpolator > QInterpolatorVector
Definition
qvariantanimation.cpp:375
castToInterpolator
static QVariantAnimation::Interpolator castToInterpolator(QVariant(*func)(const T &from, const T &to, qreal progress))
Definition
qvariantanimation.cpp:427
qRegisterAnimationInterpolator
void qRegisterAnimationInterpolator(QVariant(*func)(const T &from, const T &to, qreal progress))
Definition
qvariantanimation.h:82
_q_interpolateVariant
QVariant _q_interpolateVariant(const T &from, const T &to, qreal progress)
Definition
qvariantanimation_p.h:96
_q_interpolate
std::enable_if<!std::is_unsigned< T >::value, T >::type _q_interpolate(const T &f, const T &t, qreal progress)
Definition
qvariantanimation_p.h:91
_q_interpolate
std::enable_if< std::is_unsigned< T >::value, T >::type _q_interpolate(const T &f, const T &t, qreal progress)
Definition
qvariantanimation_p.h:83
qtbase
src
corelib
animation
qvariantanimation_p.h
Generated on
for Qt by
1.18.0