45 #include <QtCore/qrect.h> 46 #include <QtCore/qline.h> 47 #include <QtCore/qmutex.h> 48 #include <private/qmutexpool_p.h> 50 #ifndef QT_NO_ANIMATION 189 qreal x1, y1, w1, h1;
191 qreal x2, y2, w2, h2;
301 const qreal localProgress = (progress - startProgress) / (endProgress - startProgress);
309 if (!changedSignalIndex) {
324 return result->second;
332 qWarning(
"QVariantAnimation::setValueAt: invalid step = %f", step);
339 if (result ==
keyValues.
end() || result->first != step) {
343 result->second = value;
414 d->recalculateCurrentInterval();
458 if (
int(interpolationType) >= interpolators->
count())
459 interpolators->
resize(
int(interpolationType) + 1);
460 interpolators->
replace(interpolationType, func);
477 if (interpolationType < interpolators->count()) {
478 ret = interpolators->
at(interpolationType);
482 switch(interpolationType)
535 qWarning(
"QVariantAnimation::setDuration: cannot set a negative duration");
538 if (
d->duration == msecs)
541 d->recalculateCurrentInterval();
599 return d_func()->valueAt(step);
624 d_func()->setValueAt(step, value);
634 return d_func()->keyValues;
648 d->recalculateCurrentInterval(
true);
674 if (!
d->currentValue.isValid())
675 const_cast<QVariantAnimationPrivate*>(
d)->recalculateCurrentInterval();
676 return d->currentValue;
727 d_func()->recalculateCurrentInterval();
732 #include "moc_qvariantanimation.cpp" 734 #endif //QT_NO_ANIMATION The QVariant class acts like a union for the most common Qt data types.
void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const
Extracts the position of the rectangle's top-left corner to *x and y, and its dimensions to *width an...
void setKeyValueAt(qreal step, const QVariant &value)
Creates a key frame at the given step with the given value.
KeyValues keyValues() const
Returns the key frames of this animation.
qreal valueForProgress(qreal progress) const
Return the effective progress for the easing curve at progress.
#define QT_END_NAMESPACE
This macro expands to.
State
This enum describes the state of the animation.
The QEasingCurve class provides easing curves for controlling animation.
void replace(int i, const T &t)
Replaces the item at index position i with value.
The QLine class provides a two-dimensional vector using integer precision.
void setValueAt(qreal, const QVariant &)
#define it(className, varName)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
QPoint p1() const
Returns the line's start point.
void convertValues(int t)
QPointF p1() const
Returns the line's start point.
QPoint p2() const
Returns the line's end point.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector...
QVariant valueAt(qreal step) const
int left() const
Returns the x-coordinate of the rectangle's left edge.
QVariant endValue() const
void setEasingCurve(const QEasingCurve &easing)
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
void setKeyValues(const KeyValues &values)
Replaces the current set of key frames with the given keyValues.
virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const
This virtual function returns the linear interpolation between variants from and to, at progress, usually a value between 0 and 1.
static Q_CORE_EXPORT QVariantAnimation::Interpolator getInterpolator(int interpolationType)
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
void setEndValue(const QVariant &value)
The QVector class is a template class that provides a dynamic array.
The QObject class is the base class of all Qt objects.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
QVariant keyValueAt(qreal step) const
Returns the key frame value for the given step.
QAbstractAnimation::Direction direction
QVariant(* Interpolator)(const void *from, const void *to, qreal progress)
void setStartValue(const QVariant &value)
QVariant currentValue() const
void resize(int size)
Sets the size of the vector to size.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
The QLineF class provides a two-dimensional vector using floating point precision.
void setDuration(int msecs)
static bool animationValueLessThan(const QVariantAnimation::KeyValue &p1, const QVariantAnimation::KeyValue &p2)
QEasingCurve easingCurve() const
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the vector.
bool testAndSetRelaxed(int expectedValue, int newValue)
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
The QVariantAnimation class provides an abstract base class for animations.
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
void setDefaultStartEndValue(const QVariant &value)
Q_CORE_EXPORT void qWarning(const char *,...)
#define Q_INLINE_TEMPLATE
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
The QAbstractAnimation class is the base of all animations.
QVariantAnimation::KeyValues keyValues
void qSort(RandomAccessIterator start, RandomAccessIterator end)
void qSwap(T &value1, T &value2)
const T & at(int i) const
Returns the item at index position i in the vector.
bool convert(Type t)
Casts the variant to the requested type, t.
KeyValue * iterator
The QVector::iterator typedef provides an STL-style non-const iterator for QVector and QStack...
static QVariantAnimation::Interpolator castToInterpolator(QVariant(*func)(const T &from, const T &to, qreal progress))
QVariant startValue() const
void insert(int i, const T &t)
Inserts value at index position i in the vector.
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
void updateInterpolator()
int top() const
Returns the y-coordinate of the rectangle's top edge.
bool isSignalConnected(uint signalIdx) const
Returns true if the signal with index signal_index from object sender is connected.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
int right() const
Returns the x-coordinate of the rectangle's right edge.
QVariantAnimation::Interpolator interpolator
iterator begin()
Returns an STL-style iterator pointing to the first item in the vector.
void updateCurrentTime(int)
Reimplemented Function
QObject * parent() const
Returns a pointer to the parent object.
QVector< QVariantAnimation::Interpolator > QInterpolatorVector
iterator erase(iterator begin, iterator end)
Removes all the items from begin up to (but not including) end.
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
Reimplemented Function
const void * constData() const
void setCurrentValueForProgress(const qreal progress)
QPointF p2() const
Returns the line's end point.
The QRect class defines a rectangle in the plane using integer precision.
void recalculateCurrentInterval(bool force=false)
The goal of this function is to update the currentInterval member.
bool event(QEvent *event)
Reimplemented Function
~QVariantAnimation()
Destroys the animation.
QVariantAnimationPrivate()
const KeyValue * const_iterator
The QVector::const_iterator typedef provides an STL-style const iterator for QVector and QStack...
static QVariant defaultInterpolator(const void *, const void *, qreal)
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Q_INLINE_TEMPLATE QRect _q_interpolate(const QRect &f, const QRect &t, qreal progress)
The QEvent class is the base class of all event classes.
bool event(QEvent *event)
Reimplemented Function
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QMutex * globalInstanceGet(const void *address)
Returns a QMutex from the global mutex pool.
QVariant defaultStartEndValue
struct QVariantAnimationPrivate::@1 currentInterval
QVariantAnimation(QObject *parent=0)
Construct a QVariantAnimation object.
int signalIndex(const char *signalName) const
Returns the signal index used in the internal connectionLists vector.
static void registerInterpolator(Interpolator func, int interpolationType)