[][src]Struct qt_core::QPropertyAnimation

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

The QPropertyAnimation class animates Qt properties

C++ class: QPropertyAnimation.

C++ documentation:

The QPropertyAnimation class animates Qt properties

QPropertyAnimation interpolates over Qt properties. As property values are stored in QVariants, the class inherits QVariantAnimation, and supports animation of the same meta types as its super class.

A class declaring properties must be a QObject. To make it possible to animate a property, it must provide a setter (so that QPropertyAnimation can set the property's value). Note that this makes it possible to animate many of Qt's widgets. Let's look at an example:

QPropertyAnimation *animation = new QPropertyAnimation(myWidget, "geometry"); animation->setDuration(10000); animation->setStartValue(QRect(0, 0, 100, 30)); animation->setEndValue(QRect(250, 250, 100, 30));

animation->start();

The property name and the QObject instance of which property should be animated are passed to the constructor. You can then specify the start and end value of the property. The procedure is equal for properties in classes you have implemented yourself--just check with QVariantAnimation that your QVariant type is supported.

The QVariantAnimation class description explains how to set up the animation in detail. Note, however, that if a start value is not set, the property will start at the value it had when the QPropertyAnimation instance was created.

QPropertyAnimation works like a charm on its own. For complex animations that, for instance, contain several objects, QAnimationGroup is provided. An animation group is an animation that can contain other animations, and that can manage when its animations are played. Look at QParallelAnimationGroup for an example.

Methods

impl QPropertyAnimation[src]

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

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

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

Construct a QPropertyAnimation object. parent is passed to QObject's constructor.

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

C++ documentation:

Construct a QPropertyAnimation object. parent is passed to QObject's constructor.

pub unsafe fn new_3a(
    target: impl CastInto<MutPtr<QObject>>,
    property_name: impl CastInto<Ref<QByteArray>>,
    parent: impl CastInto<MutPtr<QObject>>
) -> CppBox<QPropertyAnimation>
[src]

Construct a QPropertyAnimation object. parent is passed to QObject's constructor. The animation changes the property propertyName on target. The default duration is 250ms.

Calls C++ function: [constructor] void QPropertyAnimation::QPropertyAnimation(QObject* target, const QByteArray& propertyName, QObject* parent = …).

C++ documentation:

Construct a QPropertyAnimation object. parent is passed to QObject's constructor. The animation changes the property propertyName on target. The default duration is 250ms.

See also targetObject and propertyName.

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

The QPropertyAnimation class animates Qt properties

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

C++ documentation:

The QPropertyAnimation class animates Qt properties

QPropertyAnimation interpolates over Qt properties. As property values are stored in QVariants, the class inherits QVariantAnimation, and supports animation of the same meta types as its super class.

A class declaring properties must be a QObject. To make it possible to animate a property, it must provide a setter (so that QPropertyAnimation can set the property's value). Note that this makes it possible to animate many of Qt's widgets. Let's look at an example:

QPropertyAnimation *animation = new QPropertyAnimation(myWidget, "geometry"); animation->setDuration(10000); animation->setStartValue(QRect(0, 0, 100, 30)); animation->setEndValue(QRect(250, 250, 100, 30));

animation->start();

The property name and the QObject instance of which property should be animated are passed to the constructor. You can then specify the start and end value of the property. The procedure is equal for properties in classes you have implemented yourself--just check with QVariantAnimation that your QVariant type is supported.

The QVariantAnimation class description explains how to set up the animation in detail. Note, however, that if a start value is not set, the property will start at the value it had when the QPropertyAnimation instance was created.

QPropertyAnimation works like a charm on its own. For complex animations that, for instance, contain several objects, QAnimationGroup is provided. An animation group is an animation that can contain other animations, and that can manage when its animations are played. Look at QParallelAnimationGroup for an example.

pub unsafe fn new_2a(
    target: impl CastInto<MutPtr<QObject>>,
    property_name: impl CastInto<Ref<QByteArray>>
) -> CppBox<QPropertyAnimation>
[src]

Construct a QPropertyAnimation object. parent is passed to QObject's constructor. The animation changes the property propertyName on target. The default duration is 250ms.

Calls C++ function: [constructor] void QPropertyAnimation::QPropertyAnimation(QObject* target, const QByteArray& propertyName).

C++ documentation:

Construct a QPropertyAnimation object. parent is passed to QObject's constructor. The animation changes the property propertyName on target. The default duration is 250ms.

See also targetObject and propertyName.

pub unsafe fn property_name(&self) -> CppBox<QByteArray>[src]

This property holds the target property name for this animation

Calls C++ function: QByteArray QPropertyAnimation::propertyName() const.

C++ documentation:

This property holds the target property name for this animation

This property defines the target property name for this animation. The property name is required for the animation to operate.

Access functions:

QByteArray propertyName() const
void setPropertyName(const QByteArray &propertyName)

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 QPropertyAnimation::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* QPropertyAnimation::qt_metacast(const char* arg1).

pub unsafe fn set_property_name(
    &mut self,
    property_name: impl CastInto<Ref<QByteArray>>
)
[src]

This property holds the target property name for this animation

Calls C++ function: void QPropertyAnimation::setPropertyName(const QByteArray& propertyName).

C++ documentation:

This property holds the target property name for this animation

This property defines the target property name for this animation. The property name is required for the animation to operate.

Access functions:

QByteArray propertyName() const
void setPropertyName(const QByteArray &propertyName)

pub unsafe fn set_target_object(
    &mut self,
    target: impl CastInto<MutPtr<QObject>>
)
[src]

This property holds the target QObject for this animation.

Calls C++ function: void QPropertyAnimation::setTargetObject(QObject* target).

C++ documentation:

This property holds the target QObject for this animation.

This property defines the target QObject for this animation.

Access functions:

QObject *targetObject() const
void setTargetObject(QObject *target)

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

Returns a reference to the staticMetaObject field.

pub unsafe fn target_object(&self) -> MutPtr<QObject>[src]

This property holds the target QObject for this animation.

Calls C++ function: QObject* QPropertyAnimation::targetObject() const.

C++ documentation:

This property holds the target QObject for this animation.

This property defines the target QObject for this animation.

Access functions:

QObject *targetObject() const
void setTargetObject(QObject *target)

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 QPropertyAnimation::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 QPropertyAnimation::trUtf8(const char* s, const char* c, int n).

Methods from Deref<Target = QVariantAnimation>

pub fn value_changed(&self) -> Signal<(*const QVariant,)>[src]

QVariantAnimation emits this signal whenever the current value changes.

Returns a built-in Qt signal QVariantAnimation::valueChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

QVariantAnimation emits this signal whenever the current value changes.

Note: Notifier signal for property currentValue.

See also currentValue, startValue, and endValue.

pub unsafe fn current_value(&self) -> CppBox<QVariant>[src]

This property holds the current value of the animation.

Calls C++ function: QVariant QVariantAnimation::currentValue() const.

C++ documentation:

This property holds the current value of the animation.

This property describes the current value; an interpolated value between the start value and the end value, using the current time for progress. The value itself is obtained from interpolated(), which is called repeatedly as the animation is running.

QVariantAnimation calls the virtual updateCurrentValue() function when the current value changes. This is particularly useful for subclasses that need to track updates. For example, QPropertyAnimation uses this function to animate Qt properties.

Access functions:

QVariant currentValue() const

Notifier signal:

void valueChanged(const QVariant &value)

See also startValue and endValue.

pub unsafe fn duration(&self) -> c_int[src]

This property holds the duration of the animation

Calls C++ function: virtual int QVariantAnimation::duration() const.

C++ documentation:

This property holds the duration of the animation

This property describes the duration in milliseconds of the animation. The default duration is 250 milliseconds.

Access functions:

virtual int duration() const
void setDuration(int msecs)

See also QAbstractAnimation::duration().

pub unsafe fn easing_curve(&self) -> CppBox<QEasingCurve>[src]

This property holds the easing curve of the animation

Calls C++ function: QEasingCurve QVariantAnimation::easingCurve() const.

C++ documentation:

This property holds the easing curve of the animation

This property defines the easing curve of the animation. By default, a linear easing curve is used, resulting in linear interpolation. Other curves are provided, for instance, QEasingCurve::InCirc, which provides a circular entry curve. Another example is QEasingCurve::InOutElastic, which provides an elastic effect on the values of the interpolated variant.

QVariantAnimation will use the QEasingCurve::valueForProgress() to transform the "normalized progress" (currentTime / totalDuration) of the animation into the effective progress actually used by the animation. It is this effective progress that will be the progress when interpolated() is called. Also, the steps in the keyValues are referring to this effective progress.

The easing curve is used with the interpolator, the interpolated() virtual function, and the animation's duration to control how the current value changes as the animation progresses.

Access functions:

QEasingCurve easingCurve() const
void setEasingCurve(const QEasingCurve &easing)

pub unsafe fn end_value(&self) -> CppBox<QVariant>[src]

This property holds the end value of the animation

Calls C++ function: QVariant QVariantAnimation::endValue() const.

C++ documentation:

This property holds the end value of the animation

This property describes the end value of the animation.

Access functions:

QVariant endValue() const
void setEndValue(const QVariant &value)

See also startValue.

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

Returns the key frame value for the given step. The given step must be in the range 0 to 1. If there is no KeyValue for step, it returns an invalid QVariant.

Calls C++ function: QVariant QVariantAnimation::keyValueAt(double step) const.

C++ documentation:

Returns the key frame value for the given step. The given step must be in the range 0 to 1. If there is no KeyValue for step, it returns an invalid QVariant.

See also keyValues() and setKeyValueAt().

pub unsafe fn key_values(&self) -> CppBox<QVectorOfQPairOfDoubleQVariant>[src]

Returns the key frames of this animation.

Calls C++ function: QVector<QPair<double, QVariant>> QVariantAnimation::keyValues() const.

C++ documentation:

Returns the key frames of this animation.

See also keyValueAt() and setKeyValues().

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

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

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 QVariantAnimation::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* QVariantAnimation::qt_metacast(const char* arg1).

pub unsafe fn set_duration(&mut self, msecs: c_int)[src]

This property holds the duration of the animation

Calls C++ function: void QVariantAnimation::setDuration(int msecs).

C++ documentation:

This property holds the duration of the animation

This property describes the duration in milliseconds of the animation. The default duration is 250 milliseconds.

Access functions:

virtual int duration() const
void setDuration(int msecs)

See also QAbstractAnimation::duration().

pub unsafe fn set_easing_curve(
    &mut self,
    easing: impl CastInto<Ref<QEasingCurve>>
)
[src]

This property holds the easing curve of the animation

Calls C++ function: void QVariantAnimation::setEasingCurve(const QEasingCurve& easing).

C++ documentation:

This property holds the easing curve of the animation

This property defines the easing curve of the animation. By default, a linear easing curve is used, resulting in linear interpolation. Other curves are provided, for instance, QEasingCurve::InCirc, which provides a circular entry curve. Another example is QEasingCurve::InOutElastic, which provides an elastic effect on the values of the interpolated variant.

QVariantAnimation will use the QEasingCurve::valueForProgress() to transform the "normalized progress" (currentTime / totalDuration) of the animation into the effective progress actually used by the animation. It is this effective progress that will be the progress when interpolated() is called. Also, the steps in the keyValues are referring to this effective progress.

The easing curve is used with the interpolator, the interpolated() virtual function, and the animation's duration to control how the current value changes as the animation progresses.

Access functions:

QEasingCurve easingCurve() const
void setEasingCurve(const QEasingCurve &easing)

pub unsafe fn set_end_value(&mut self, value: impl CastInto<Ref<QVariant>>)[src]

This property holds the end value of the animation

Calls C++ function: void QVariantAnimation::setEndValue(const QVariant& value).

C++ documentation:

This property holds the end value of the animation

This property describes the end value of the animation.

Access functions:

QVariant endValue() const
void setEndValue(const QVariant &value)

See also startValue.

pub unsafe fn set_key_value_at(
    &mut self,
    step: c_double,
    value: impl CastInto<Ref<QVariant>>
)
[src]

Creates a key frame at the given step with the given value. The given step must be in the range 0 to 1.

Calls C++ function: void QVariantAnimation::setKeyValueAt(double step, const QVariant& value).

C++ documentation:

Creates a key frame at the given step with the given value. The given step must be in the range 0 to 1.

See also setKeyValues() and keyValueAt().

pub unsafe fn set_key_values(
    &mut self,
    values: impl CastInto<Ref<QVectorOfQPairOfDoubleQVariant>>
)
[src]

Replaces the current set of key frames with the given keyValues. the step of the key frames must be in the range 0 to 1.

Calls C++ function: void QVariantAnimation::setKeyValues(const QVector<QPair<double, QVariant>>& values).

C++ documentation:

Replaces the current set of key frames with the given keyValues. the step of the key frames must be in the range 0 to 1.

See also keyValues() and keyValueAt().

pub unsafe fn set_start_value(&mut self, value: impl CastInto<Ref<QVariant>>)[src]

This property holds the optional start value of the animation

Calls C++ function: void QVariantAnimation::setStartValue(const QVariant& value).

C++ documentation:

This property holds the optional start value of the animation

This property describes the optional start value of the animation. If omitted, or if a null QVariant is assigned as the start value, the animation will use the current position of the end when the animation is started.

Access functions:

QVariant startValue() const
void setStartValue(const QVariant &value)

See also endValue.

pub unsafe fn start_value(&self) -> CppBox<QVariant>[src]

This property holds the optional start value of the animation

Calls C++ function: QVariant QVariantAnimation::startValue() const.

C++ documentation:

This property holds the optional start value of the animation

This property describes the optional start value of the animation. If omitted, or if a null QVariant is assigned as the start value, the animation will use the current position of the end when the animation is started.

Access functions:

QVariant startValue() const
void setStartValue(const QVariant &value)

See also endValue.

Trait Implementations

impl Deref for QPropertyAnimation[src]

type Target = QVariantAnimation

The resulting type after dereferencing.

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

Calls C++ function: QVariantAnimation* static_cast<QVariantAnimation*>(QPropertyAnimation* ptr).

impl DerefMut for QPropertyAnimation[src]

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

Calls C++ function: QVariantAnimation* static_cast<QVariantAnimation*>(QPropertyAnimation* ptr).

impl StaticUpcast<QVariantAnimation> for QPropertyAnimation[src]

unsafe fn static_upcast(ptr: Ptr<QPropertyAnimation>) -> Ptr<QVariantAnimation>[src]

Calls C++ function: QVariantAnimation* static_cast<QVariantAnimation*>(QPropertyAnimation* ptr).

unsafe fn static_upcast_mut(
    ptr: MutPtr<QPropertyAnimation>
) -> MutPtr<QVariantAnimation>
[src]

Calls C++ function: QVariantAnimation* static_cast<QVariantAnimation*>(QPropertyAnimation* ptr).

impl StaticUpcast<QAbstractAnimation> for QPropertyAnimation[src]

unsafe fn static_upcast(ptr: Ptr<QPropertyAnimation>) -> Ptr<QAbstractAnimation>[src]

Calls C++ function: QAbstractAnimation* static_cast<QAbstractAnimation*>(QPropertyAnimation* ptr).

unsafe fn static_upcast_mut(
    ptr: MutPtr<QPropertyAnimation>
) -> MutPtr<QAbstractAnimation>
[src]

Calls C++ function: QAbstractAnimation* static_cast<QAbstractAnimation*>(QPropertyAnimation* ptr).

impl StaticUpcast<QObject> for QPropertyAnimation[src]

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

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

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

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

impl StaticDowncast<QPropertyAnimation> for QVariantAnimation[src]

unsafe fn static_downcast(
    ptr: Ptr<QVariantAnimation>
) -> Ptr<QPropertyAnimation>
[src]

Calls C++ function: QPropertyAnimation* static_cast<QPropertyAnimation*>(QVariantAnimation* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QVariantAnimation>
) -> MutPtr<QPropertyAnimation>
[src]

Calls C++ function: QPropertyAnimation* static_cast<QPropertyAnimation*>(QVariantAnimation* ptr).

impl StaticDowncast<QPropertyAnimation> for QAbstractAnimation[src]

unsafe fn static_downcast(
    ptr: Ptr<QAbstractAnimation>
) -> Ptr<QPropertyAnimation>
[src]

Calls C++ function: QPropertyAnimation* static_cast<QPropertyAnimation*>(QAbstractAnimation* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QAbstractAnimation>
) -> MutPtr<QPropertyAnimation>
[src]

Calls C++ function: QPropertyAnimation* static_cast<QPropertyAnimation*>(QAbstractAnimation* ptr).

impl StaticDowncast<QPropertyAnimation> for QObject[src]

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

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

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

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

impl DynamicCast<QPropertyAnimation> for QVariantAnimation[src]

unsafe fn dynamic_cast(ptr: Ptr<QVariantAnimation>) -> Ptr<QPropertyAnimation>[src]

Calls C++ function: QPropertyAnimation* dynamic_cast<QPropertyAnimation*>(QVariantAnimation* ptr).

unsafe fn dynamic_cast_mut(
    ptr: MutPtr<QVariantAnimation>
) -> MutPtr<QPropertyAnimation>
[src]

Calls C++ function: QPropertyAnimation* dynamic_cast<QPropertyAnimation*>(QVariantAnimation* ptr).

impl DynamicCast<QPropertyAnimation> for QAbstractAnimation[src]

unsafe fn dynamic_cast(ptr: Ptr<QAbstractAnimation>) -> Ptr<QPropertyAnimation>[src]

Calls C++ function: QPropertyAnimation* dynamic_cast<QPropertyAnimation*>(QAbstractAnimation* ptr).

unsafe fn dynamic_cast_mut(
    ptr: MutPtr<QAbstractAnimation>
) -> MutPtr<QPropertyAnimation>
[src]

Calls C++ function: QPropertyAnimation* dynamic_cast<QPropertyAnimation*>(QAbstractAnimation* ptr).

impl DynamicCast<QPropertyAnimation> for QObject[src]

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

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

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

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

impl CppDeletable for QPropertyAnimation[src]

unsafe fn delete(&mut self)[src]

Destroys the QPropertyAnimation instance.

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

C++ documentation:

Destroys the QPropertyAnimation instance.

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<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.

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

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

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

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

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