QtBase  v6.3.1
Public Slots | Public Member Functions | Protected Member Functions | List of all members
QGraphicsItemAnimation Class Reference

The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem. More...

#include <qgraphicsitemanimation.h>

Inheritance diagram for QGraphicsItemAnimation:
Inheritance graph
[legend]
Collaboration diagram for QGraphicsItemAnimation:
Collaboration graph
[legend]

Public Slots

void setStep (qreal x)
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Member Functions

 QGraphicsItemAnimation (QObject *parent=nullptr)
 
virtual ~QGraphicsItemAnimation ()
 
QGraphicsItemitem () const
 
void setItem (QGraphicsItem *item)
 
QTimeLinetimeLine () const
 
void setTimeLine (QTimeLine *timeLine)
 
QPointF posAt (qreal step) const
 
QList< QPair< qreal, QPointF > > posList () const
 
void setPosAt (qreal step, const QPointF &pos)
 
QTransform transformAt (qreal step) const
 
qreal rotationAt (qreal step) const
 
QList< QPair< qreal, qreal > > rotationList () const
 
void setRotationAt (qreal step, qreal angle)
 
qreal xTranslationAt (qreal step) const
 
qreal yTranslationAt (qreal step) const
 
QList< QPair< qreal, QPointF > > translationList () const
 
void setTranslationAt (qreal step, qreal dx, qreal dy)
 
qreal verticalScaleAt (qreal step) const
 
qreal horizontalScaleAt (qreal step) const
 
QList< QPair< qreal, QPointF > > scaleList () const
 
void setScaleAt (qreal step, qreal sx, qreal sy)
 
qreal verticalShearAt (qreal step) const
 
qreal horizontalShearAt (qreal step) const
 
QList< QPair< qreal, QPointF > > shearList () const
 
void setShearAt (qreal step, qreal sh, qreal sv)
 
void clear ()
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 
virtual ~QObject ()
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const noexcept
 
bool blockSignals (bool b) noexcept
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 
template<typename T >
T findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
const QObjectListchildren () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 
void dumpObjectInfo () const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 

Protected Member Functions

virtual void beforeAnimationStep (qreal step)
 
virtual void afterAnimationStep (qreal step)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Additional Inherited Members

- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object More...
 

Detailed Description

The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem.

Since
4.2

\inmodule QtWidgets

Deprecated:

The QGraphicsItemAnimation class animates a QGraphicsItem. You can schedule changes to the item's transformation matrix at specified steps. The QGraphicsItemAnimation class has a current step value. When this value changes the transformations scheduled at that step are performed. The current step of the animation is set with the setStep() function.

QGraphicsItemAnimation will do a simple linear interpolation between the nearest adjacent scheduled changes to calculate the matrix. For instance, if you set the position of an item at values 0.0 and 1.0, the animation will show the item moving in a straight line between these positions. The same is true for scaling and rotation.

It is usual to use the class with a QTimeLine. The timeline's \l{QTimeLine::}{valueChanged()} signal is then connected to the setStep() slot. For example, you can set up an item for rotation by calling setRotationAt() for different step values. The animations timeline is set with the setTimeLine() function.

An example animation with a timeline follows:

Note that steps lie between 0.0 and 1.0. It may be necessary to use \l{QTimeLine::}{setUpdateInterval()}. The default update interval is 40 ms. A scheduled transformation cannot be removed when set, so scheduling several transformations of the same kind (e.g., rotations) at the same step is not recommended.

See also
QTimeLine, {Graphics View Framework}

Definition at line 56 of file qgraphicsitemanimation.h.

Constructor & Destructor Documentation

◆ QGraphicsItemAnimation()

QGraphicsItemAnimation::QGraphicsItemAnimation ( QObject parent = nullptr)

Constructs an animation object with the given parent.

Definition at line 193 of file qgraphicsitemanimation.cpp.

◆ ~QGraphicsItemAnimation()

QGraphicsItemAnimation::~QGraphicsItemAnimation ( )
virtual

Destroys the animation object.

Definition at line 202 of file qgraphicsitemanimation.cpp.

Member Function Documentation

◆ afterAnimationStep()

void QGraphicsItemAnimation::afterAnimationStep ( qreal  step)
protectedvirtual

This method is meant to be overridden in subclasses that need to execute additional code after a new step has taken place. The animation step is provided for use in cases where the action depends on its value.

Definition at line 576 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ beforeAnimationStep()

void QGraphicsItemAnimation::beforeAnimationStep ( qreal  step)
protectedvirtual

This method is meant to be overridden by subclassed that needs to execute additional code before a new step takes place. The animation step is provided for use in cases where the action depends on its value.

Definition at line 563 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ clear()

void QGraphicsItemAnimation::clear ( )

Clears the scheduled transformations used for the animation, but retains the item and timeline.

Definition at line 511 of file qgraphicsitemanimation.cpp.

◆ horizontalScaleAt()

qreal QGraphicsItemAnimation::horizontalScaleAt ( qreal  step) const

Returns the horizontal scale for the item at the specified step value.

See also
setScaleAt()

Definition at line 423 of file qgraphicsitemanimation.cpp.

◆ horizontalShearAt()

qreal QGraphicsItemAnimation::horizontalShearAt ( qreal  step) const

Returns the horizontal shear for the item at the specified step value.

See also
setShearAt()

Definition at line 473 of file qgraphicsitemanimation.cpp.

◆ item()

QGraphicsItem * QGraphicsItemAnimation::item ( ) const

Returns the item on which the animation object operates.

See also
setItem()

Definition at line 212 of file qgraphicsitemanimation.cpp.

Here is the caller graph for this function:

◆ posAt()

QPointF QGraphicsItemAnimation::posAt ( qreal  step) const

Returns the position of the item at the given step value.

See also
setPosAt()

Definition at line 262 of file qgraphicsitemanimation.cpp.

◆ posList()

QList< QPair< qreal, QPointF > > QGraphicsItemAnimation::posList ( ) const

Returns all explicitly inserted positions.

See also
posAt(), setPosAt()

Definition at line 287 of file qgraphicsitemanimation.cpp.

◆ rotationAt()

qreal QGraphicsItemAnimation::rotationAt ( qreal  step) const

Returns the angle at which the item is rotated at the specified step value.

See also
setRotationAt()

Definition at line 324 of file qgraphicsitemanimation.cpp.

◆ rotationList()

QList< QPair< qreal, qreal > > QGraphicsItemAnimation::rotationList ( ) const

Returns all explicitly inserted rotations.

See also
rotationAt(), setRotationAt()

Definition at line 345 of file qgraphicsitemanimation.cpp.

◆ scaleList()

QList< QPair< qreal, QPointF > > QGraphicsItemAnimation::scaleList ( ) const

Returns all explicitly inserted scales.

See also
verticalScaleAt(), horizontalScaleAt(), setScaleAt()

Definition at line 446 of file qgraphicsitemanimation.cpp.

◆ setItem()

void QGraphicsItemAnimation::setItem ( QGraphicsItem item)

Sets the specified item to be used in the animation.

See also
item()

Definition at line 222 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ setPosAt()

void QGraphicsItemAnimation::setPosAt ( qreal  step,
const QPointF point 
)

Sets the position of the item at the given step value to the point specified.

See also
posAt()

Definition at line 276 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ setRotationAt()

void QGraphicsItemAnimation::setRotationAt ( qreal  step,
qreal  angle 
)

Sets the rotation of the item at the given step value to the angle specified.

See also
rotationAt()

Definition at line 335 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ setScaleAt()

void QGraphicsItemAnimation::setScaleAt ( qreal  step,
qreal  sx,
qreal  sy 
)

Sets the scale of the item at the given step value using the horizontal and vertical scale factors specified by sx and sy.

See also
verticalScaleAt(), horizontalScaleAt()

Definition at line 435 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ setShearAt()

void QGraphicsItemAnimation::setShearAt ( qreal  step,
qreal  sh,
qreal  sv 
)

Sets the shear of the item at the given step value using the horizontal and vertical shear factors specified by sh and sv.

See also
verticalShearAt(), horizontalShearAt()

Definition at line 485 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ setStep

void QGraphicsItemAnimation::setStep ( qreal  step)
slot

Sets the current step value for the animation, causing the transformations scheduled at this step to be performed.

Definition at line 530 of file qgraphicsitemanimation.cpp.

Here is the caller graph for this function:

◆ setTimeLine()

void QGraphicsItemAnimation::setTimeLine ( QTimeLine timeLine)

Sets the timeline object used to control the rate of animation to the timeLine specified.

See also
timeLine()

Definition at line 245 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ setTranslationAt()

void QGraphicsItemAnimation::setTranslationAt ( qreal  step,
qreal  dx,
qreal  dy 
)

Sets the translation of the item at the given step value using the horizontal and vertical coordinates specified by dx and dy.

See also
xTranslationAt(), yTranslationAt()

Definition at line 384 of file qgraphicsitemanimation.cpp.

Here is the call graph for this function:

◆ shearList()

QList< QPair< qreal, QPointF > > QGraphicsItemAnimation::shearList ( ) const

Returns all explicitly inserted shears.

See also
verticalShearAt(), horizontalShearAt(), setShearAt()

Definition at line 496 of file qgraphicsitemanimation.cpp.

◆ timeLine()

QTimeLine * QGraphicsItemAnimation::timeLine ( ) const

Returns the timeline object used to control the rate at which the animation occurs.

See also
setTimeLine()

Definition at line 234 of file qgraphicsitemanimation.cpp.

Here is the caller graph for this function:

◆ transformAt()

QTransform QGraphicsItemAnimation::transformAt ( qreal  step) const

Returns the transform used for the item at the specified step value.

Since
5.14

Definition at line 303 of file qgraphicsitemanimation.cpp.

◆ translationList()

QList< QPair< qreal, QPointF > > QGraphicsItemAnimation::translationList ( ) const

Returns all explicitly inserted translations.

See also
xTranslationAt(), yTranslationAt(), setTranslationAt()

Definition at line 395 of file qgraphicsitemanimation.cpp.

◆ verticalScaleAt()

qreal QGraphicsItemAnimation::verticalScaleAt ( qreal  step) const

Returns the vertical scale for the item at the specified step value.

See also
setScaleAt()

Definition at line 411 of file qgraphicsitemanimation.cpp.

◆ verticalShearAt()

qreal QGraphicsItemAnimation::verticalShearAt ( qreal  step) const

Returns the vertical shear for the item at the specified step value.

See also
setShearAt()

Definition at line 462 of file qgraphicsitemanimation.cpp.

◆ xTranslationAt()

qreal QGraphicsItemAnimation::xTranslationAt ( qreal  step) const

Returns the horizontal translation of the item at the specified step value.

See also
setTranslationAt()

Definition at line 361 of file qgraphicsitemanimation.cpp.

◆ yTranslationAt()

qreal QGraphicsItemAnimation::yTranslationAt ( qreal  step) const

Returns the vertical translation of the item at the specified step value.

See also
setTranslationAt()

Definition at line 372 of file qgraphicsitemanimation.cpp.


The documentation for this class was generated from the following files: