QQuickWebEngineScript — PyQt Documentation v5.15.7 (original) (raw)
PyQt5.QtWebEngine.QQuickWebEngineScript
Inherits from QObject.
Description¶
Enables the injection of scripts in the JavaScript engine.
The QQuickWebEngineScript type enables the programmatic injection of so called user scripts in the JavaScript engine at different points, determined by injectionPoint(), during the loading of web content.
Scripts can be executed either in the main JavaScript world, along with the rest of the JavaScript coming from the web contents, or in their own isolated world. While the DOM of the page can be accessed from any world, JavaScript variables of a function defined in one world are not accessible from a different one. The worldId() property provides some predefined IDs for this purpose.
Enums¶
InjectionPoint
The point in the loading process at which the script will be executed.
Member | Value | Description |
---|---|---|
Deferred | 0 | The script will run when the page load finishes, or 500 ms after the document is ready, whichever comes first. |
DocumentCreation | 2 | The script will be executed as soon as the document is created. This is not suitable for any DOM operation. |
DocumentReady | 1 | The script will run as soon as the DOM is ready. This is equivalent to the DOMContentLoaded event firing in JavaScript. |
ScriptWorldId
TODO
Member | Value | Description |
---|---|---|
ApplicationWorld | TODO | TODO |
MainWorld | TODO | TODO |
UserWorld | TODO | TODO |
Methods¶
__init__(parent: QObject = None)
TODO
injectionPoint() → InjectionPoint
See also
name() → str
runOnSubframes() → bool
See also
setInjectionPoint(InjectionPoint)
See also
setName(str)
setRunOnSubframes(bool)
See also
setSourceCode(str)
setSourceUrl(QUrl)
setWorldId(ScriptWorldId)
TODO
sourceCode() → str
See also
sourceUrl() → QUrl
timerEvent(QTimerEvent)
TODO
toString() → str
TODO
worldId() → ScriptWorldId
Signals¶
injectionPointChanged(InjectionPoint)
TODO
nameChanged(str)
TODO
runOnSubframesChanged(bool)
TODO
sourceCodeChanged(str)
TODO
sourceUrlChanged(QUrl)
TODO
worldIdChanged(ScriptWorldId)
TODO