Skip to content

Movie

Qt Base Class: QMovie

Signature: QMovie(self, device: PySide6.QtCore.QIODevice, format: Union[PySide6.QtCore.QByteArray, bytes] = Default(QByteArray), parent: Optional[PySide6.QtCore.QObject] = None) -> None QMovie(self, fileName: str, format: Union[PySide6.QtCore.QByteArray, bytes] = Default(QByteArray), parent: Optional[PySide6.QtCore.QObject] = None) -> None QMovie(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object
QMovie
PySide6.QtGui
QMovie(self, device: PySide6.QtCore.QIODevice, format: Union[PySide6.QtCore.QByteArray, bytes] \= Default(QByteArray), parent: Optional[PySide6.QtCore.QObject] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473245617776["gui.Movie"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473245491872["QtGui.QMovie"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473299815024 --> 1473245617776
  140713234304496 --> 1473299815024
  1473245491872 --> 1473245617776
  1473288842240 --> 1473245491872
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: ObjectMixin, QMovie

Convenience class for playing movies with QImageReader.

Source code in prettyqt\gui\movie.py
class Movie(core.ObjectMixin, QtGui.QMovie):
    """Convenience class for playing movies with QImageReader."""

    def __repr__(self):
        return get_repr(self, self.fileName(), self.get_format())

    def set_cache_mode(self, mode: CacheModeStr | QtGui.QMovie.CacheMode):
        """Set cache mode.

        Args:
            mode: cache mode
        """
        self.setCacheMode(CACHE_MODE.get_enum_value(mode))

    def get_cache_mode(self) -> CacheModeStr:
        """Get the current cache mode.

        Returns:
            cache mode
        """
        return CACHE_MODE.inverse[self.cacheMode()]

    def get_state(self) -> MovieStateStr:
        """Get the current state.

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

    def get_format(self) -> str:
        return self.format().data().decode()

    @classmethod
    def get_supported_formats(cls) -> list[str]:
        return [i.data().decode() for i in cls.supportedFormats()]

get_cache_mode() -> CacheModeStr

Get the current cache mode.

Source code in prettyqt\gui\movie.py
def get_cache_mode(self) -> CacheModeStr:
    """Get the current cache mode.

    Returns:
        cache mode
    """
    return CACHE_MODE.inverse[self.cacheMode()]

get_state() -> MovieStateStr

Get the current state.

Source code in prettyqt\gui\movie.py
def get_state(self) -> MovieStateStr:
    """Get the current state.

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

set_cache_mode(mode: CacheModeStr | QtGui.QMovie.CacheMode)

Set cache mode.

Parameters:

Name Type Description Default
mode CacheModeStr | CacheMode

cache mode

required
Source code in prettyqt\gui\movie.py
def set_cache_mode(self, mode: CacheModeStr | QtGui.QMovie.CacheMode):
    """Set cache mode.

    Args:
        mode: cache mode
    """
    self.setCacheMode(CACHE_MODE.get_enum_value(mode))

⌗ Property table

Qt Property Type Doc
objectName QString
speed int
cacheMode QMovie::CacheMode