Skip to content

TimeLine

Qt Base Class: QTimeLine

Signature: QTimeLine(self, duration: int = 1000, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object
QTimeLine
PySide6.QtCore
QTimeLine(self, duration: int \= 1000, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473299818928["core.TimeLine"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473288858832["QtCore.QTimeLine"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473299815024 --> 1473299818928
  140713234304496 --> 1473299815024
  1473288858832 --> 1473299818928
  1473288842240 --> 1473288858832
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: ObjectMixin, QTimeLine

Timeline for controlling animations.

Source code in prettyqt\core\timeline.py
class TimeLine(core.ObjectMixin, core.QTimeLine):
    """Timeline for controlling animations."""

    def _get_map(self):
        maps = super()._get_map()
        maps |= {"direction": DIRECTION}
        return maps

    def set_direction(self, direction: DirectionStr | core.QTimeLine.Direction):
        """Set the direction.

        Args:
            direction: direction
        """
        self.setDirection(DIRECTION.get_enum_value(direction))

    def get_direction(self) -> DirectionStr:
        """Return current direction.

        Returns:
            direction
        """
        return DIRECTION.inverse[self.direction()]

    def get_state(self) -> StateStr:
        """Return current state.

        Returns:
            state
        """
        return STATE.inverse[self.state()]

    def set_easing(
        self,
        easing_type: core.easingcurve.TypeStr
        | core.QEasingCurve.Type
        | Callable[[float], float],
    ) -> core.EasingCurve:
        curve = core.EasingCurve()
        if callable(easing_type):
            curve.set_custom_type(easing_type)
        else:
            curve.set_type(easing_type)
        self.setEasingCurve(curve)
        return curve

    def get_easing(self) -> core.easingcurve.TypeStr | Callable[[float], float]:
        curve = core.EasingCurve(self.easingCurve())
        typ = curve.get_type()
        return curve.get_custom_type() if typ == "custom" else typ

get_direction() -> DirectionStr

Return current direction.

Source code in prettyqt\core\timeline.py
def get_direction(self) -> DirectionStr:
    """Return current direction.

    Returns:
        direction
    """
    return DIRECTION.inverse[self.direction()]

get_state() -> StateStr

Return current state.

Source code in prettyqt\core\timeline.py
def get_state(self) -> StateStr:
    """Return current state.

    Returns:
        state
    """
    return STATE.inverse[self.state()]

set_direction(direction: DirectionStr | core.QTimeLine.Direction)

Set the direction.

Parameters:

Name Type Description Default
direction DirectionStr | Direction

direction

required
Source code in prettyqt\core\timeline.py
def set_direction(self, direction: DirectionStr | core.QTimeLine.Direction):
    """Set the direction.

    Args:
        direction: direction
    """
    self.setDirection(DIRECTION.get_enum_value(direction))

⌗ Property table

Qt Property Type Doc
objectName QString
duration int
updateInterval int
currentTime int
direction QTimeLine::Direction
loopCount int
easingCurve QEasingCurve