From 132a42c28e35ac69a5af8c2b7d478b86e92b87e4 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 19 Nov 2009 11:08:50 +0100 Subject: Complete QVariantAnimation doc to mention qRegisterAnimationInterpolator Task-number: QTBUG-5970 --- src/corelib/animation/qvariantanimation.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/corelib/animation') diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index c7357783f2..d529f670fa 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -104,15 +104,32 @@ QT_BEGIN_NAMESPACE \o \l{QMetaType::}{QLine} \o \l{QMetaType::}{QLineF} \o \l{QMetaType::}{QPoint} + \o \l{QMetaType::}{QPointF} \o \l{QMetaType::}{QSize} \o \l{QMetaType::}{QSizeF} \o \l{QMetaType::}{QRect} \o \l{QMetaType::}{QRectF} + \o \l{QMetaType::}{QColor} \endlist If you need to interpolate other variant types, including custom types, you have to implement interpolation for these yourself. - You do this by reimplementing interpolated(), which returns + To do this, you can register an interpolator function for a given + type. This function takes 3 parameters: the start value, the end value + and the current progress. + + Example: + \code + QVariant myColorInterpolator(const QColor &start, const QColor &end, qreal progress) + { + ... + return QColor(...); + } + ... + qRegisterAnimationInterpolator(myColorInterpolator); + \endcode + + Another option is to reimplement interpolated(), which returns interpolation values for the value being interpolated. \omit We need some snippets around here. \endomit -- cgit v1.2.3