diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-10-07 08:33:31 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-10-07 15:35:45 +0200 |
| commit | b9da1ecd9aeb4ed67e14c6f5f118dbf77fbadd93 (patch) | |
| tree | 8ffa10350c73e22177b4264b3f969451823eb0f4 /sources/pyside6/PySide6 | |
| parent | 732fdd80b363a714fadeed75981a7f8bf7b4032a (diff) | |
PySide6: Add documentation for QWebEnginePage's added functions
Fixes: PYSIDE-2883
Change-Id: I56733c7b2bb3e573084ba0b281ad48e7fc6da5f7
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6')
| -rw-r--r-- | sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml | 16 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/doc/qtwebenginecore.rst | 48 |
2 files changed, 64 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml b/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml index c0a5d6f68..1a8f0bfa8 100644 --- a/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml +++ b/sources/pyside6/PySide6/QtWebEngineCore/typesystem_webenginecore.xml @@ -100,14 +100,26 @@ <add-function signature="findText(const QString &@subString@,QWebEnginePage::FindFlags@options@,PyCallable*@resultCallback@)"> <inject-code class="target" position="beginning" file="../glue/qtwebenginecore.cpp" snippet="qwebenginepage-findtext"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-findtext"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-async-note"/> </add-function> <add-function signature="toPlainText(PyCallable*@resultCallback@) const"> <inject-code class="target" position="beginning" file="../glue/qtwebenginecore.cpp" snippet="qwebenginepage-convertto"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-toplaintext"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-async-note"/> </add-function> <add-function signature="toHtml(PyCallable*@resultCallback@) const"> <inject-code class="target" position="beginning" file="../glue/qtwebenginecore.cpp" snippet="qwebenginepage-convertto"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-tohtml"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-async-note"/> </add-function> <modify-function signature="^runJavaScript\(.*\)$" remove="yes"/> <add-function signature="runJavaScript(const QString &@scriptSource@,PyCallable*@resultCallback@)"> @@ -117,6 +129,10 @@ <add-function signature="runJavaScript(const QString &@scriptSource@,quint32@worldId@=0,PyCallable*@resultCallback@={})"> <inject-code class="target" position="beginning" file="../glue/qtwebenginecore.cpp" snippet="qwebenginepage-runjavascript-3"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-runjavascript"/> + <inject-documentation format="target" mode="append" file="../doc/qtwebenginecore.rst" + snippet="qwebenginepage-async-note"/> </add-function> </object-type> diff --git a/sources/pyside6/PySide6/doc/qtwebenginecore.rst b/sources/pyside6/PySide6/doc/qtwebenginecore.rst new file mode 100644 index 000000000..951fa31f9 --- /dev/null +++ b/sources/pyside6/PySide6/doc/qtwebenginecore.rst @@ -0,0 +1,48 @@ +// @snippet qwebenginepage-async-note +.. note:: We guarantee that the ``resultCallback`` is always called, but it + might be done during page destruction. When ``QWebEnginePage`` + is deleted, the callback is triggered with an invalid value and it + is not safe to use the corresponding ``QWebEnginePage``, + ``QWebEngineFrame``, or ``QWebEngineView`` instance inside it. +// @snippet qwebenginepage-async-note + +// @snippet qwebenginepage-findtext +Finds the specified string, ``subString``, in the page, using the given +``options``. The ``findTextFinished()`` signal is emitted when a string search +is completed. + +To clear the search highlight, just pass an empty string. + +The ``resultCallback`` must take a ``QWebEngineFindTextResult`` parameter. +// @snippet qwebenginepage-findtext + +// @snippet qwebenginepage-tohtml +Asynchronous method to retrieve the page's content as HTML, enclosed in HTML +and BODY tags. Upon successful completion, ``resultCallback`` is called with +the page's content. +// @snippet qwebenginepage-tohtml + +// @snippet qwebenginepage-toplaintext +Asynchronous method to retrieve the page's content converted to plain text, +completely stripped of all HTML formatting. + +Upon successful completion, ``resultCallback`` is called with the page's content. +// @snippet qwebenginepage-toplaintext + +// @snippet qwebenginepage-runjavascript +Runs the JavaScript code contained in ``scriptSource`` script on this frame, +without checking whether the DOM of the page has been constructed. + +To avoid conflicts with other scripts executed on the page, the world in which +the script is run is specified by ``worldId``. The world ID values are the same +as provided by ``QWebEngineScript.ScriptWorldId``, and between 0 and 256. If +you leave out the world ID, the script is run in the ``MainWorld`` (0). + +When the script has been executed, the callable ``resultCallback`` is called +with the result of the last executed statement. + +Only plain data can be returned from JavaScript as the result value. + +.. note:: Do not execute lengthy routines in the callback function, because + it might block the rendering of the web engine page. +// @snippet qwebenginepage-runjavascript |
