Skip to content

JSEngineMixin

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object

Subclasses

Class Module Description
JSEngine prettyqt.qml.jsengine
QmlEngineMixin prettyqt.qml.qmlengine

⋔ Inheritance diagram

graph TD
  1473572333536["qml.JSEngineMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473299815024 --> 1473572333536
  140713234304496 --> 1473299815024

🛈 DocStrings

Bases: ObjectMixin

Source code in prettyqt\qml\jsengine.py
class JSEngineMixin(core.ObjectMixin):
    def install_extensions(self, extension: str, obj: qml.QJSValue | None = None):
        if obj is None:
            obj = qml.QJSValue()
        self.installExtensions(EXTENSIONS[extension], obj)

    def new_array(self, length: int = 0) -> qml.JSValue:
        return qml.JSValue(self.newArray(length))

    def eval(self, program: str) -> qml.JSValue:
        result = self.evaluate(program)
        return qml.JSValue(result)  # type: ignore