CopperSpice API
1.9.2
|
The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem. More...
Public Slots | |
void | reset () |
void | setStep (qreal step) |
Public Slots inherited from QObject | |
void | deleteLater () |
Public Methods | |
QGraphicsItemAnimation (QObject *parent=nullptr) | |
virtual | ~QGraphicsItemAnimation () |
void | clear () |
qreal | horizontalScaleAt (qreal step) const |
qreal | horizontalShearAt (qreal step) const |
QGraphicsItem * | item () const |
QMatrix | matrixAt (qreal step) const |
QPointF | posAt (qreal step) const |
QList< QPair< qreal, QPointF > > | posList () const |
qreal | rotationAt (qreal step) const |
QList< QPair< qreal, qreal > > | rotationList () const |
QList< QPair< qreal, QPointF > > | scaleList () const |
void | setItem (QGraphicsItem *item) |
void | setPosAt (qreal step, const QPointF &point) |
void | setRotationAt (qreal step, qreal angle) |
void | setScaleAt (qreal step, qreal sx, qreal sy) |
void | setShearAt (qreal step, qreal sh, qreal sv) |
void | setTimeLine (QTimeLine *timeLine) |
void | setTranslationAt (qreal step, qreal dx, qreal dy) |
QList< QPair< qreal, QPointF > > | shearList () const |
QTimeLine * | timeLine () const |
QList< QPair< qreal, QPointF > > | translationList () const |
qreal | verticalScaleAt (qreal step) const |
qreal | verticalShearAt (qreal step) const |
qreal | xTranslationAt (qreal step) const |
qreal | yTranslationAt (qreal step) const |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Protected Methods | |
virtual void | afterAnimationStep (qreal step) |
virtual void | beforeAnimationStep (qreal step) |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Properties inherited from QObject | |
objectName | |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem.
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 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 setUpdateInterval(). The default update interval is 40 ms. A scheduled transformation can not be removed when set, so scheduling several transformations of the same kind (e.g., rotations) at the same step is not recommended.
QGraphicsItemAnimation::QGraphicsItemAnimation | ( | QObject * | parent = nullptr | ) |
Constructs an animation object with the given parent.
|
virtual |
Destroys the animation object.
|
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.
|
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.
void QGraphicsItemAnimation::clear | ( | ) |
Clears the scheduled transformations used for the animation, but retains the item and timeline.
Returns the horizontal scale for the item at the specified step value.
Returns the horizontal shear for the item at the specified step value.
QGraphicsItem * QGraphicsItemAnimation::item | ( | ) | const |
Returns the item on which the animation object operates.
Returns the matrix used to transform the item at the specified step value.
Returns the position of the item at the given step value.
Returns all explicitly inserted positions.
|
deprecatedslot |
You can call setStep(0) instead.
Returns the angle at which the item is rotated at the specified step value.
Returns all explicitly inserted rotations.
Returns all explicitly inserted scales.
void QGraphicsItemAnimation::setItem | ( | QGraphicsItem * | item | ) |
Sets the specified item to be used in the animation.
Sets the position of the item at the given step value to the point specified.
Sets the rotation of the item at the given step value to the angle specified.
Sets the scale of the item at the given step value using the horizontal and vertical scale factors specified by sx and sy.
Sets the shear of the item at the given step value using the horizontal and vertical shear factors specified by sh and sv.
|
slot |
Sets the current step value for the animation, causing the transformations scheduled at this step to be performed.
void QGraphicsItemAnimation::setTimeLine | ( | QTimeLine * | timeLine | ) |
Sets the timeline object used to control the rate of animation to the timeLine specified.
Sets the translation of the item at the given step value using the horizontal and vertical coordinates specified by dx and dy.
Returns all explicitly inserted shears.
QTimeLine * QGraphicsItemAnimation::timeLine | ( | ) | const |
Returns the timeline object used to control the rate at which the animation occurs.
Returns all explicitly inserted translations.
Returns the vertical scale for the item at the specified step value.
Returns the vertical shear for the item at the specified step value.
Returns the horizontal translation of the item at the specified step value.
Returns the vertical translation of the item at the specified step value.