Skip to content

PythonQt.QtCore.QVariantAnimation

QVariantAnimation

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

This class is part of The Animation Framework. It serves as a base class for property and item animations, with functions for shared functionality.

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

You can then set start and end values for the property by calling setStartValue() and setEndValue(), and finally call start() to start the animation. QVariantAnimation will interpolate the property of the target object and emit valueChanged(). To react to a change in the current value you have to reimplement the updateCurrentValue() 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 QVariantAnimation interpolates the values. You can set an easing curve by calling setEasingCurve(), and configure the duration by calling setDuration(). You can change how the QVariants are interpolated by creating a subclass of QVariantAnimation, and reimplementing the virtual interpolated() function.

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

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

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:

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

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

Source: https://doc.qt.io/archives/qt-5.15/qvariantanimation.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
Backward attribute Any (shared captured text)
DeleteWhenStopped attribute Any (shared captured text)
DeletionPolicy attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Direction attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Forward attribute Any (shared captured text)
KeepWhenStopped attribute Any (shared captured text)
Paused attribute Any (shared captured text)
Running attribute Any (shared captured text)
State attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Stopped attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
currentLoop attribute Any (shared captured text)
currentLoopChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtCore.QVariantAnimation.currentLoopChanged; argument details are not documented.
currentLoopTime function (self) -> int X.currentLoopTime() -> int (shared captured text)
currentTime attribute Any (shared captured text)
currentValue attribute Any This property holds the current value of the animation.
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtCore.QVariantAnimation.destroyed; argument details are not documented.
direction attribute Any (shared captured text)
directionChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtCore.QVariantAnimation.directionChanged; argument details are not documented.
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
duration attribute int This property holds the duration of the animation
dynamicPropertyNames function (self) -> Any (shared captured text)
easingCurve attribute QEasingCurve This property holds the easing curve of the animation
endValue attribute Any This property holds the end value of the animation
event function (self, event: Any) -> bool X.event(event) -> bool
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
finished function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtCore.QVariantAnimation.finished; argument details are not documented.
group function (self) -> Any X.group() -> PythonQt.QtCore.QAnimationGroup (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
interpolated function (self, *args: Any, **kwargs: Any) -> Any X.interpolated(from, to, progress) -> object
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
keyValueAt function (self, step: float) -> Any X.keyValueAt(step) -> object
keyValues function (self) -> tuple X.keyValues() -> tuple
killTimer function (self, id: Any) -> Any (shared captured text)
loopCount attribute Any (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtCore.QVariantAnimation.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
pause function (self) -> Any (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
resume function (self) -> Any (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setCurrentTime function (self, msecs: Any) -> Any (shared captured text)
setDirection function (self, direction: Any) -> Any (shared captured text)
setDuration function (self, msecs: int) -> None
setEasingCurve function (self, easing: Any) -> None
setEndValue function (self, value: Any) -> None
setKeyValueAt function (self, step: float, value: Any) -> None X.setKeyValueAt(step, value)
setKeyValues function (self, values: Any) -> None 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.
setLoopCount function (self, loopCount: Any) -> Any (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setPaused function (self, a: Any) -> Any (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setStartValue function (self, value: Any) -> None
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
start function (self, policy: Any) -> Any (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
startValue attribute Any This property holds the optional start value of the animation
state attribute Any (shared captured text)
stateChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtCore.QVariantAnimation.stateChanged; argument details are not documented.
stop function (self) -> Any (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
totalDuration function (self) -> int X.totalDuration() -> int (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
updateCurrentTime function (self, arg__1: int) -> None Reimplements: [QAbstractAnimation::updateCurrentTime](https://doc.qt.io/archives/qt-5.15/qabstractanimation.html#updateCurrentTime)(int currentTime).
updateCurrentValue function (self, value: Any) -> None
updateDirection function (self, direction: Any) -> Any (shared captured text)
updateState function (self, newState: Any, oldState: Any) -> None X.updateState(newState, oldState)
valueChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtCore.QVariantAnimation.valueChanged; argument details are not documented.