Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QPropertyAnimation Class

The QPropertyAnimation class animates Qt properties More...

 #include <QPropertyAnimation>

Inherits: QVariantAnimation.

This class was introduced in Qt 4.6.

Public Types

enum DeletionPolicy { KeepWhenStopped, DeleteWhenStopped }
enum Direction { Forward, Backward }
typedef KeyValue
typedef KeyValues
enum State { Stopped, Paused, Running }

Properties

  • 1 property inherited from QObject

Public Functions

QAbstractAnimation(QObject * parent = 0)
QPropertyAnimation(QObject * parent = 0)
QPropertyAnimation(QObject * target, const QByteArray & propertyName, QObject * parent = 0)
QVariantAnimation(QObject * parent = 0)
virtual ~QAbstractAnimation()
~QPropertyAnimation()
~QVariantAnimation()
int currentLoop() const
int currentLoopTime() const
int currentTime() const
QVariant currentValue() const
Direction direction() const
virtual int duration() const
QEasingCurve easingCurve() const
QVariant endValue() const
QAnimationGroup * group() const
QVariant keyValueAt(qreal step) const
KeyValues keyValues() const
int loopCount() const
QByteArray propertyName() const
void setDirection(Direction direction)
void setDuration(int msecs)
void setEasingCurve(const QEasingCurve & easing)
void setEndValue(const QVariant & value)
void setKeyValueAt(qreal step, const QVariant & value)
void setKeyValues(const KeyValues & keyValues)
void setLoopCount(int loopCount)
void setPropertyName(const QByteArray & propertyName)
void setStartValue(const QVariant & value)
void setTargetObject(QObject * target)
QVariant startValue() const
State state() const
QObject * targetObject() const
int totalDuration() const
  • 31 public functions inherited from QObject

Public Slots

void pause()
void resume()
void setCurrentTime(int msecs)
void setPaused(bool paused)
void start(QAbstractAnimation::DeletionPolicy policy = KeepWhenStopped)
void stop()
  • 1 public slot inherited from QObject

Signals

void currentLoopChanged(int currentLoop)
void directionChanged(QAbstractAnimation::Direction newDirection)
void finished()
void stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
void valueChanged(const QVariant & value)

Protected Functions

virtual bool event(QEvent * event)
virtual QVariant interpolated(const QVariant & from, const QVariant & to, qreal progress) const
virtual void updateCurrentTime(int)
virtual void updateCurrentValue(const QVariant & value) = 0
virtual void updateDirection(QAbstractAnimation::Direction direction)
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)

Reimplemented Protected Functions

virtual bool event(QEvent * event)
virtual void updateCurrentValue(const QVariant & value)
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 11 static public members inherited from QObject

Detailed Description

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 variant types(obsolete) 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.

See also QVariantAnimation, QAnimationGroup, and The Animation Framework.

Property Documentation

propertyName : QByteArray

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)

targetObject : QObject *

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)

Member Function Documentation

QPropertyAnimation::QPropertyAnimation(QObject * parent = 0)

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

QPropertyAnimation::QPropertyAnimation(QObject * target, const QByteArray & propertyName, QObject * parent = 0)

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.

QPropertyAnimation::~QPropertyAnimation()

Destroys the QPropertyAnimation instance.

bool QPropertyAnimation::event(QEvent * event) [virtual protected]

Reimplemented from QObject::event().

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

Reimplemented from QVariantAnimation::updateCurrentValue().

This virtual function is called by QVariantAnimation whenever the current value changes. value is the new, updated value. It updates the current value of the property on the target object.

See also currentValue and currentTime.

void QPropertyAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) [virtual protected]

Reimplemented from QAbstractAnimation::updateState().

If the startValue is not defined when the state of the animation changes from Stopped to Running, the current property value is used as the initial value for the animation.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web