IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QVariantAnimation Class

The https:// class provides a base class for animations.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QVariantAnimation Class▲

  • Header: QVariantAnimation

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Core)

    target_link_libraries(mytarget PRIVATE Qt6::Core)

  • qmake: QT += core

  • Inherits: https://

  • Inherited By: https://

  • Group: QVariantAnimation is part of https://

Detailed Description▲

This class is part of https://. It serves as a base class for property and item animations, with functions for shared functionality.

The class performs interpolation over https://s, but leaves using the interpolated values to its subclasses. Currently, Qt provides https://, which animates Qt https://. See the https:// class description if you wish to animate such properties.

You can then set start and end values for the property by calling https://() and https://(), and finally call https://() to start the animation. https:// will interpolate the property of the target object and emit https://(). To react to a change in the current value you have to reimplement the https://() virtual function or connect to said signal.

It is also possible to set values at specified steps situated between the start and end value. The interpolation will then touch these points at the specified steps. Note that the start and end values are defined as the key values at 0.0 and 1.0.

There are two ways to affect how https:// interpolates the values. You can set an easing curve by calling https://(), and configure the duration by calling https://(). You can change how the https://s are interpolated by creating a subclass of https://, and reimplementing the virtual https://() function.

Subclassing https:// can be an alternative if you have https://s that you do not wish to declare as Qt properties. Note, however, that you in most cases will be better off declaring your https:// as a property.

Not all https:// types are supported. Below is a list of currently supported https:// types:

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

  • https://

If you need to interpolate other variant types, including custom types, you have to implement interpolation for these yourself. To do this, you can register an interpolator function for a given type. This function takes 3 parameters: the start value, the end value, and the current progress.

Example:

 
Sélectionnez
    QVariant myColorInterpolator(const QColor &start, const QColor &end, qreal progress)
    {
        ...
        return QColor(...);
    }
    ...
    qRegisterAnimationInterpolator<QColor>(myColorInterpolator);

Another option is to reimplement https://(), which returns interpolation values for the value being interpolated.

See Also▲

See also https://, https://, https://

Member Type Documentation▲

 

QVariantAnimation::KeyValue▲

This is a typedef for https://<qreal, https://>.

QVariantAnimation::KeyValues▲

This is a typedef for https://<https://>

Property Documentation▲

 

[read-only] currentValue : const QVariant▲

This property holds the current value of the animation.

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

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

Access functions:

  • currentValue() const

Notifier signal:

  • void https://(const &value)

See Also▲

See also https://, https://

[bindable] duration : int▲

This property supports https:// bindings.

This property holds the duration of the animation

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

See Also▲

See also https://()

[bindable] easingCurve : QEasingCurve▲

This property supports https:// bindings.

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, https://, which provides a circular entry curve. Another example is https://, which provides an elastic effect on the values of the interpolated variant.

https:// will use the https://() 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 https://() is called. Also, the steps in the https:// are referring to this effective progress.

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

endValue : QVariant▲

This property holds the end value of the animation

This property describes the end value of the animation.

Access functions:

  • endValue() const

  • void setEndValue(const &value)

See Also▲

See also https://

startValue : QVariant▲

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 https:// is assigned as the start value, the animation will use the current position of the end when the animation is started.

Access functions:

  • startValue() const

  • void setStartValue(const &value)

See Also▲

See also https://

Member Function Documentation▲

 

QVariantAnimation::QVariantAnimation(QObject *parent = nullptr)▲

Construct a https:// object. parent is passed to https://'s constructor.

[virtual] QVariantAnimation::~QVariantAnimation()▲

Destroys the animation.

[override virtual protected] bool QVariantAnimation::event(QEvent *event)▲

Reimplements: https://.

[virtual protected] QVariant QVariantAnimation::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. You can reimplement this function in a subclass of https:// to provide your own interpolation algorithm.

Note that in order for the interpolation to work with a https:// that return a value smaller than 0 or larger than 1 (such as https://) you should make sure that it can extrapolate. If the semantic of the datatype does not allow extrapolation this function should handle that gracefully.

You should call the https:// implementation of this function if you want your class to handle the types already supported by Qt (see class https:// description for a list of supported types).

See Also▲

See also https://

QVariant QVariantAnimation::keyValueAt(qreal step) const▲

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

See Also▲

See also https://(), https://()

QVariantAnimation::KeyValues QVariantAnimation::keyValues() const▲

Returns the key frames of this animation.

See Also▲

See also https://(), https://()

void QVariantAnimation::setKeyValueAt(qreal step, const QVariant &value)▲

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▲

See also https://(), https://()

void QVariantAnimation::setKeyValues(const QVariantAnimation::KeyValues &keyValues)▲

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▲

See also https://(), https://()

[override virtual protected] void QVariantAnimation::updateCurrentTime(int)▲

Reimplements: https://.

[virtual protected] void QVariantAnimation::updateCurrentValue(const QVariant &value)▲

This virtual function is called every time the animation's current value changes. The value argument is the new current value.

The base class implementation does nothing.

See Also▲

See also https://

[override virtual protected] void QVariantAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)▲

Reimplements: https://.

void QVariantAnimation::valueChanged(const QVariant &value)▲

https:// emits this signal whenever the current value changes.

Notifier signal for property https://.

See Also▲

See also https://, https://, https://

Related Non-Members▲

 

void qRegisterAnimationInterpolator(QVariant (*)(const T &, const T &, qreal) func)▲

Registers a custom interpolator func for the template type T. The interpolator has to be registered before the animation is constructed. To unregister (and use the default interpolator) set func to nullptr.

This function is thread-safe.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+   

Ce document est disponible sous la licence https:// telle que publiée par la Free Software Foundation.