Skip to content

PropertyAnimation

Qt Base Class: QPropertyAnimation

Signature: QPropertyAnimation(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None QPropertyAnimation(self, target: PySide6.QtCore.QObject, propertyName: Union[PySide6.QtCore.QByteArray, bytes], parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
VariantAnimationMixin
prettyqt.core.variantanimation
QPropertyAnimation
PySide6.QtCore
QPropertyAnimation(self, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

Subclasses

Class Module Description
SlideAnimation prettyqt.animations.slideanimation
TextAnimation prettyqt.animations.textanimation

⋔ Inheritance diagram

graph TD
  1473299825760["core.PropertyAnimation"]
  1473299835520["core.VariantAnimationMixin"]
  1473299791600["core.AbstractAnimationMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473289070624["QtCore.QPropertyAnimation"]
  1473289069648["QtCore.QVariantAnimation"]
  1473289055008["QtCore.QAbstractAnimation"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473299835520 --> 1473299825760
  1473299791600 --> 1473299835520
  1473299815024 --> 1473299791600
  140713234304496 --> 1473299815024
  1473289070624 --> 1473299825760
  1473289069648 --> 1473289070624
  1473289055008 --> 1473289069648
  1473288842240 --> 1473289055008
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: VariantAnimationMixin, QPropertyAnimation

Animates Qt properties.

Source code in prettyqt\core\propertyanimation.py
class PropertyAnimation(core.VariantAnimationMixin, core.QPropertyAnimation):
    """Animates Qt properties."""

    ID = "property"

    def __init__(self, *args, **kwargs):
        match args:
            case (core.QObject(), str(), *rest):
                super().__init__(args[0], bytes(args[1]), *rest, **kwargs)
            case _:
                super().__init__(*args, **kwargs)

    def _get_map(self):
        maps = super()._get_map()
        maps |= {"easingCurve": core.easingcurve.TYPE}
        return maps

    def apply_to(self, method: Callable):
        self.setTargetObject(method.__self__)
        self.set_property_name(method.__name__)

    def set_property_name(self, name: datatypes.ByteArrayType):
        name = datatypes.to_bytearray(name)
        self.setPropertyName(name)

    def get_property_name(self) -> str:
        return self.propertyName().data().decode()

    def get_property_value(self) -> Any:
        """Return the value of the property which should get animated."""
        prop_name = self.get_property_name()
        obj = self.targetObject()
        return obj.property(prop_name)

get_property_value() -> Any

Return the value of the property which should get animated.

Source code in prettyqt\core\propertyanimation.py
def get_property_value(self) -> Any:
    """Return the value of the property which should get animated."""
    prop_name = self.get_property_name()
    obj = self.targetObject()
    return obj.property(prop_name)

⌗ Property table

Qt Property Type Doc
objectName QString
state QAbstractAnimation::State
loopCount int
currentTime int
currentLoop int
direction QAbstractAnimation::Direction
duration int
startValue QVariant
endValue QVariant
currentValue QVariant
duration int
easingCurve QEasingCurve
propertyName QByteArray
targetObject QObject