• PySide 模块
  • PySide.QtCore
  • 内容表

    上一话题

    QVariantAnimation

    下一话题

    QPauseAnimation

    QPropertyAnimation

    注意

    该类在 Qt4.6 引入

    概要

    函数

    详细描述

    PySide.QtCore.QPropertyAnimation class animates Qt properties

    PySide.QtCore.QPropertyAnimation interpolates over Qt properties . As property values are stored in PySide.QtCore.QVariant s, the class inherits PySide.QtCore.QVariantAnimation , and supports animation of the same variant types as its super class.

    A class declaring properties must be a PySide.QtCore.QObject . To make it possible to animate a property, it must provide a setter (so that PySide.QtCore.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 PySide.QtCore.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 PySide.QtCore.QVariantAnimation that your PySide.QtCore.QVariant type is supported.

    PySide.QtCore.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 PySide.QtCore.QPropertyAnimation instance was created.

    PySide.QtCore.QPropertyAnimation works like a charm on its own. For complex animations that, for instance, contain several objects, PySide.QtCore.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 PySide.QtCore.QParallelAnimationGroup 范例。

    class PySide.QtCore. QPropertyAnimation ( [ parent=None ] )
    class PySide.QtCore. QPropertyAnimation ( target , propertyName [ , parent=None ] )
    参数:

    构造 PySide.QtCore.QPropertyAnimation 对象。 parent 会被传递给 PySide.QtCore.QObject ‘s constructor.

    构造 PySide.QtCore.QPropertyAnimation 对象。 parent 会被传递给 PySide.QtCore.QObject ‘s constructor. The animation changes the property propertyName on target . The default duration is 250ms.

    PySide.QtCore.QPropertyAnimation. propertyName ( )
    返回类型: PySide.QtCore.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.

    PySide.QtCore.QPropertyAnimation. setPropertyName ( propertyName )
    参数: propertyName PySide.QtCore.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.

    PySide.QtCore.QPropertyAnimation. setTargetObject ( target )
    参数: target PySide.QtCore.QObject

    This property holds the target PySide.QtCore.QObject for this animation..

    This property defines the target PySide.QtCore.QObject for this animation.

    PySide.QtCore.QPropertyAnimation. targetObject ( )
    返回类型: PySide.QtCore.QObject

    This property holds the target PySide.QtCore.QObject for this animation..

    This property defines the target PySide.QtCore.QObject for this animation.