[][src]Struct qt_widgets::QGraphicsItemAnimation

#[repr(C)]
pub struct QGraphicsItemAnimation { /* fields omitted */ }

The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem.

C++ class: QGraphicsItemAnimation.

C++ documentation:

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:

QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);

QTimeLine *timer = new QTimeLine(5000); timer->setFrameRange(0, 100);

QGraphicsItemAnimation *animation = new QGraphicsItemAnimation; animation->setItem(ball); animation->setTimeLine(timer);

for (int i = 0; i < 200; ++i) animation->setPosAt(i / 200.0, QPointF(i, i));

QGraphicsScene *scene = new QGraphicsScene(); scene->setSceneRect(0, 0, 250, 250); scene->addItem(ball);

QGraphicsView *view = new QGraphicsView(scene); view->show();

timer->start();

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 cannot be removed when set, so scheduling several transformations of the same kind (e.g., rotations) at the same step is not recommended.

Methods

impl QGraphicsItemAnimation[src]

pub fn slot_set_step(&self) -> Receiver<(c_double,)>[src]

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

Returns a built-in Qt slot QGraphicsItemAnimation::setStep that can be passed to qt_core::Signal::connect.

C++ documentation:

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

pub fn slot_reset(&self) -> Receiver<()>[src]

Resets the item to its starting position and transformation.

Returns a built-in Qt slot QGraphicsItemAnimation::reset that can be passed to qt_core::Signal::connect.

C++ documentation:

Resets the item to its starting position and transformation.

You can call setStep(0) instead.

pub unsafe fn clear(&mut self)[src]

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

Calls C++ function: void QGraphicsItemAnimation::clear().

C++ documentation:

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

pub unsafe fn horizontal_scale_at(&self, step: c_double) -> c_double[src]

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

Calls C++ function: double QGraphicsItemAnimation::horizontalScaleAt(double step) const.

C++ documentation:

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

See also setScaleAt().

pub unsafe fn horizontal_shear_at(&self, step: c_double) -> c_double[src]

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

Calls C++ function: double QGraphicsItemAnimation::horizontalShearAt(double step) const.

C++ documentation:

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

See also setShearAt().

pub unsafe fn item(&self) -> MutPtr<QGraphicsItem>[src]

Returns the item on which the animation object operates.

Calls C++ function: QGraphicsItem* QGraphicsItemAnimation::item() const.

C++ documentation:

Returns the item on which the animation object operates.

See also setItem().

pub unsafe fn matrix_at(&self, step: c_double) -> CppBox<QMatrix>[src]

Returns the matrix used to transform the item at the specified step value.

Calls C++ function: QMatrix QGraphicsItemAnimation::matrixAt(double step) const.

C++ documentation:

Returns the matrix used to transform the item at the specified step value.

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QGraphicsItemAnimation::metaObject() const.

pub unsafe fn new_1a(
    parent: impl CastInto<MutPtr<QObject>>
) -> CppBox<QGraphicsItemAnimation>
[src]

Constructs an animation object with the given parent.

Calls C++ function: [constructor] void QGraphicsItemAnimation::QGraphicsItemAnimation(QObject* parent = …).

C++ documentation:

Constructs an animation object with the given parent.

pub unsafe fn new_0a() -> CppBox<QGraphicsItemAnimation>[src]

The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem.

Calls C++ function: [constructor] void QGraphicsItemAnimation::QGraphicsItemAnimation().

C++ documentation:

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:

QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);

QTimeLine *timer = new QTimeLine(5000); timer->setFrameRange(0, 100);

QGraphicsItemAnimation *animation = new QGraphicsItemAnimation; animation->setItem(ball); animation->setTimeLine(timer);

for (int i = 0; i < 200; ++i) animation->setPosAt(i / 200.0, QPointF(i, i));

QGraphicsScene *scene = new QGraphicsScene(); scene->setSceneRect(0, 0, 250, 250); scene->addItem(ball);

QGraphicsView *view = new QGraphicsView(scene); view->show();

timer->start();

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 cannot be removed when set, so scheduling several transformations of the same kind (e.g., rotations) at the same step is not recommended.

pub unsafe fn pos_at(&self, step: c_double) -> CppBox<QPointF>[src]

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

Calls C++ function: QPointF QGraphicsItemAnimation::posAt(double step) const.

C++ documentation:

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

See also setPosAt().

pub unsafe fn pos_list(&self) -> CppBox<QListOfQPairOfDoubleQPointF>[src]

Returns all explicitly inserted positions.

Calls C++ function: QList<QPair<double, QPointF>> QGraphicsItemAnimation::posList() const.

C++ documentation:

Returns all explicitly inserted positions.

See also posAt() and setPosAt().

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QGraphicsItemAnimation::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QGraphicsItemAnimation::qt_metacast(const char* arg1).

pub unsafe fn reset(&mut self)[src]

Resets the item to its starting position and transformation.

Calls C++ function: [slot] void QGraphicsItemAnimation::reset().

C++ documentation:

Resets the item to its starting position and transformation.

You can call setStep(0) instead.

pub unsafe fn rotation_at(&self, step: c_double) -> c_double[src]

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

Calls C++ function: double QGraphicsItemAnimation::rotationAt(double step) const.

C++ documentation:

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

See also setRotationAt().

pub unsafe fn rotation_list(&self) -> CppBox<QListOfQPairOfDoubleDouble>[src]

Returns all explicitly inserted rotations.

Calls C++ function: QList<QPair<double, double>> QGraphicsItemAnimation::rotationList() const.

C++ documentation:

Returns all explicitly inserted rotations.

See also rotationAt() and setRotationAt().

pub unsafe fn scale_list(&self) -> CppBox<QListOfQPairOfDoubleQPointF>[src]

Returns all explicitly inserted scales.

Calls C++ function: QList<QPair<double, QPointF>> QGraphicsItemAnimation::scaleList() const.

C++ documentation:

Returns all explicitly inserted scales.

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

pub unsafe fn set_item(&mut self, item: impl CastInto<MutPtr<QGraphicsItem>>)[src]

Sets the specified item to be used in the animation.

Calls C++ function: void QGraphicsItemAnimation::setItem(QGraphicsItem* item).

C++ documentation:

Sets the specified item to be used in the animation.

See also item().

pub unsafe fn set_pos_at(
    &mut self,
    step: c_double,
    pos: impl CastInto<Ref<QPointF>>
)
[src]

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

Calls C++ function: void QGraphicsItemAnimation::setPosAt(double step, const QPointF& pos).

C++ documentation:

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

See also posAt().

pub unsafe fn set_rotation_at(&mut self, step: c_double, angle: c_double)[src]

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

Calls C++ function: void QGraphicsItemAnimation::setRotationAt(double step, double angle).

C++ documentation:

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

See also rotationAt().

pub unsafe fn set_scale_at(
    &mut self,
    step: c_double,
    sx: c_double,
    sy: c_double
)
[src]

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

Calls C++ function: void QGraphicsItemAnimation::setScaleAt(double step, double sx, double sy).

C++ documentation:

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() and horizontalScaleAt().

pub unsafe fn set_shear_at(
    &mut self,
    step: c_double,
    sh: c_double,
    sv: c_double
)
[src]

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

Calls C++ function: void QGraphicsItemAnimation::setShearAt(double step, double sh, double sv).

C++ documentation:

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() and horizontalShearAt().

pub unsafe fn set_step(&mut self, x: c_double)[src]

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

Calls C++ function: [slot] void QGraphicsItemAnimation::setStep(double x).

C++ documentation:

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

pub unsafe fn set_time_line(
    &mut self,
    time_line: impl CastInto<MutPtr<QTimeLine>>
)
[src]

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

Calls C++ function: void QGraphicsItemAnimation::setTimeLine(QTimeLine* timeLine).

C++ documentation:

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

See also timeLine().

pub unsafe fn set_translation_at(
    &mut self,
    step: c_double,
    dx: c_double,
    dy: c_double
)
[src]

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

Calls C++ function: void QGraphicsItemAnimation::setTranslationAt(double step, double dx, double dy).

C++ documentation:

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() and yTranslationAt().

pub unsafe fn shear_list(&self) -> CppBox<QListOfQPairOfDoubleQPointF>[src]

Returns all explicitly inserted shears.

Calls C++ function: QList<QPair<double, QPointF>> QGraphicsItemAnimation::shearList() const.

C++ documentation:

Returns all explicitly inserted shears.

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

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn time_line(&self) -> MutPtr<QTimeLine>[src]

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

Calls C++ function: QTimeLine* QGraphicsItemAnimation::timeLine() const.

C++ documentation:

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

See also setTimeLine().

pub unsafe fn tr(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QGraphicsItemAnimation::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QGraphicsItemAnimation::trUtf8(const char* s, const char* c, int n).

pub unsafe fn translation_list(&self) -> CppBox<QListOfQPairOfDoubleQPointF>[src]

Returns all explicitly inserted translations.

Calls C++ function: QList<QPair<double, QPointF>> QGraphicsItemAnimation::translationList() const.

C++ documentation:

Returns all explicitly inserted translations.

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

pub unsafe fn vertical_scale_at(&self, step: c_double) -> c_double[src]

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

Calls C++ function: double QGraphicsItemAnimation::verticalScaleAt(double step) const.

C++ documentation:

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

See also setScaleAt().

pub unsafe fn vertical_shear_at(&self, step: c_double) -> c_double[src]

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

Calls C++ function: double QGraphicsItemAnimation::verticalShearAt(double step) const.

C++ documentation:

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

See also setShearAt().

pub unsafe fn x_translation_at(&self, step: c_double) -> c_double[src]

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

Calls C++ function: double QGraphicsItemAnimation::xTranslationAt(double step) const.

C++ documentation:

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

See also setTranslationAt().

pub unsafe fn y_translation_at(&self, step: c_double) -> c_double[src]

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

Calls C++ function: double QGraphicsItemAnimation::yTranslationAt(double step) const.

C++ documentation:

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

See also setTranslationAt().

Trait Implementations

impl CppDeletable for QGraphicsItemAnimation[src]

unsafe fn delete(&mut self)[src]

Destroys the animation object.

Calls C++ function: virtual [destructor] void QGraphicsItemAnimation::~QGraphicsItemAnimation().

C++ documentation:

Destroys the animation object.

impl Deref for QGraphicsItemAnimation[src]

type Target = QObject

The resulting type after dereferencing.

fn deref(&self) -> &QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QGraphicsItemAnimation* ptr).

impl DerefMut for QGraphicsItemAnimation[src]

fn deref_mut(&mut self) -> &mut QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QGraphicsItemAnimation* ptr).

impl DynamicCast<QGraphicsItemAnimation> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QGraphicsItemAnimation>[src]

Calls C++ function: QGraphicsItemAnimation* dynamic_cast<QGraphicsItemAnimation*>(QObject* ptr).

unsafe fn dynamic_cast_mut(
    ptr: MutPtr<QObject>
) -> MutPtr<QGraphicsItemAnimation>
[src]

Calls C++ function: QGraphicsItemAnimation* dynamic_cast<QGraphicsItemAnimation*>(QObject* ptr).

impl StaticDowncast<QGraphicsItemAnimation> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QGraphicsItemAnimation>[src]

Calls C++ function: QGraphicsItemAnimation* static_cast<QGraphicsItemAnimation*>(QObject* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QObject>
) -> MutPtr<QGraphicsItemAnimation>
[src]

Calls C++ function: QGraphicsItemAnimation* static_cast<QGraphicsItemAnimation*>(QObject* ptr).

impl StaticUpcast<QObject> for QGraphicsItemAnimation[src]

unsafe fn static_upcast(ptr: Ptr<QGraphicsItemAnimation>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QGraphicsItemAnimation* ptr).

unsafe fn static_upcast_mut(
    ptr: MutPtr<QGraphicsItemAnimation>
) -> MutPtr<QObject>
[src]

Calls C++ function: QObject* static_cast<QObject*>(QGraphicsItemAnimation* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.