Skip to content

QmlApplicationEngine

Base classes

Name Children Inherits
QmlEngineMixin
prettyqt.qml.qmlengine
QQmlApplicationEngine
PySide6.QtQml
QQmlApplicationEngine(self, uri: str, typeName: str, /, parent: PySide6.QtCore.QObject | None \= None) -> None

⋔ Inheritance diagram

graph TD
  1450356405["qml.QmlApplicationEngine"]
  3784176072["qml.QmlEngineMixin"]
  3962672466["qml.JSEngineMixin"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  2557568199["QtQml.QQmlApplicationEngine"]
  1214884787["QtQml.QQmlEngine"]
  885857458["QtQml.QJSEngine"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  3784176072 --> 1450356405
  3962672466 --> 3784176072
  3227531497 --> 3962672466
  2751680898 --> 3227531497
  2751680898 --> 3962672466
  2751680898 --> 3784176072
  2557568199 --> 1450356405
  1214884787 --> 2557568199
  885857458 --> 1214884787
  3984060476 --> 885857458
  37984305 --> 3984060476
  2751680898 --> 37984305

🛈 DocStrings

Bases: QmlEngineMixin, QQmlApplicationEngine

Convenient way to load an application from a single QML file.

Source code in prettyqt/qml/qmlapplicationengine.py
class QmlApplicationEngine(qml.QmlEngineMixin, qml.QQmlApplicationEngine):
    """Convenient way to load an application from a single QML file."""

    def __iter__(self) -> Iterator[QtCore.QObject]:
        return iter(self.rootObjects())

    def load_data(
        self,
        data: datatypes.ByteArrayType,
        url: datatypes.UrlType | os.PathLike[str] | None = None,
    ):
        data = datatypes.to_bytearray(data)
        url = datatypes.to_local_url(url)
        self.loadData(data, url)

    def load_file(self, file: datatypes.UrlType | datatypes.PathType):
        if isinstance(file, os.PathLike):
            file = os.fspath(file)
        self.load(file)

:fa-brands-github: Show source on GitHub