Qt 4.8
Functions
qguivariantanimation.cpp File Reference
#include <QtCore/qvariantanimation.h>
#include <private/qvariantanimation_p.h>
#include <QtGui/qcolor.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
#include <QtGui/qquaternion.h>

Go to the source code of this file.

Functions

template<>
Q_INLINE_TEMPLATE QColor _q_interpolate (const QColor &f, const QColor &t, qreal progress)
 
template<>
Q_INLINE_TEMPLATE QQuaternion _q_interpolate (const QQuaternion &f, const QQuaternion &t, qreal progress)
 
static int qRegisterGuiGetInterpolator ()
 
static int qUnregisterGuiGetInterpolator ()
 

Function Documentation

◆ _q_interpolate() [1/2]

template<>
Q_INLINE_TEMPLATE QColor _q_interpolate ( const QColor f,
const QColor t,
qreal  progress 
)

Definition at line 54 of file qguivariantanimation.cpp.

55 {
56  return QColor(qBound(0,_q_interpolate(f.red(), t.red(), progress),255),
57  qBound(0,_q_interpolate(f.green(), t.green(), progress),255),
58  qBound(0,_q_interpolate(f.blue(), t.blue(), progress),255),
59  qBound(0,_q_interpolate(f.alpha(), t.alpha(), progress),255));
60 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
Q_INLINE_TEMPLATE QColor _q_interpolate(const QColor &f, const QColor &t, qreal progress)
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
ushort alpha
Returns the alpha color component of this color.
Definition: qcolor.h:242
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
Definition: qglobal.h:1219
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244

◆ _q_interpolate() [2/2]

template<>
Q_INLINE_TEMPLATE QQuaternion _q_interpolate ( const QQuaternion f,
const QQuaternion t,
qreal  progress 
)

Definition at line 62 of file qguivariantanimation.cpp.

63 {
64  return QQuaternion::slerp(f, t, progress);
65 }
static QQuaternion slerp(const QQuaternion &q1, const QQuaternion &q2, qreal t)
Interpolates along the shortest spherical path between the rotational positions q1 and q2...

◆ qRegisterGuiGetInterpolator()

static int qRegisterGuiGetInterpolator ( )
static

Definition at line 67 of file qguivariantanimation.cpp.

68 {
69  qRegisterAnimationInterpolator<QColor>(_q_interpolateVariant<QColor>);
70  qRegisterAnimationInterpolator<QVector2D>(_q_interpolateVariant<QVector2D>);
71  qRegisterAnimationInterpolator<QVector3D>(_q_interpolateVariant<QVector3D>);
72  qRegisterAnimationInterpolator<QVector4D>(_q_interpolateVariant<QVector4D>);
73  qRegisterAnimationInterpolator<QQuaternion>(_q_interpolateVariant<QQuaternion>);
74  return 1;
75 }

◆ qUnregisterGuiGetInterpolator()

static int qUnregisterGuiGetInterpolator ( )
static

Definition at line 78 of file qguivariantanimation.cpp.

79 {
80  // casts required by Sun CC 5.5
81  qRegisterAnimationInterpolator<QColor>(
82  (QVariant (*)(const QColor &, const QColor &, qreal))0);
83  qRegisterAnimationInterpolator<QVector2D>(
84  (QVariant (*)(const QVector2D &, const QVector2D &, qreal))0);
85  qRegisterAnimationInterpolator<QVector3D>(
86  (QVariant (*)(const QVector3D &, const QVector3D &, qreal))0);
87  qRegisterAnimationInterpolator<QVector4D>(
88  (QVariant (*)(const QVector4D &, const QVector4D &, qreal))0);
89  qRegisterAnimationInterpolator<QQuaternion>(
90  (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0);
91 
92  return 1;
93 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QVector3D class represents a vector or vertex in 3D space.
Definition: qvector3d.h:60
double qreal
Definition: qglobal.h:1193
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
The QQuaternion class represents a quaternion consisting of a vector and scalar.
Definition: qquaternion.h:59