Skip to content

PropertyAnimation

Sub classes

Name Children Inherits
SlideAnimation
prettyqt.animations.slideanimation
    TextAnimation
    prettyqt.animations.textanimation

      Base classes

      Name Children Inherits
      VariantAnimationMixin
      prettyqt.core.variantanimation
      QPropertyAnimation
      PySide6.QtCore
      QPropertyAnimation(self, target: PySide6.QtCore.QObject, propertyName: PySide6.QtCore.QByteArray | bytes | bytearray | memoryview, /, parent: PySide6.QtCore.QObject | None \= None, *, targetObject: PySide6.QtCore.QObject | None \= None) -> None

      ⋔ Inheritance diagram

      graph TD
        4280009853["core.PropertyAnimation"]
        2400666939["core.VariantAnimationMixin"]
        565069530["core.AbstractAnimationMixin"]
        3227531497["core.ObjectMixin"]
        2751680898["builtins.object"]
        3508266353["QtCore.QPropertyAnimation"]
        2420859519["QtCore.QVariantAnimation"]
        2133980439["QtCore.QAbstractAnimation"]
        3984060476["QtCore.QObject"]
        37984305["Shiboken.Object"]
        2400666939 --> 4280009853
        565069530 --> 2400666939
        3227531497 --> 565069530
        2751680898 --> 3227531497
        3508266353 --> 4280009853
        2420859519 --> 3508266353
        2133980439 --> 2420859519
        3984060476 --> 2133980439
        37984305 --> 3984060476
        2751680898 --> 37984305

      🛈 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)
      

      :fa-brands-github: Show source on GitHub