diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-11-21 09:07:50 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-11-21 17:43:35 +0000 |
commit | 67a9b92baeef3a83b3c2b041ec2594a48ccd1524 (patch) | |
tree | d899f67caf79f12fa9a9068ab015f5d4f30e9f9e | |
parent | e7e74faa7bb8cc78cd5a4898b828ba495121bab0 (diff) |
Add a tutorial for QML Debugging
Pick-to: 6.5
Change-Id: I65ed5d7983099e115429d1af09fd03888eb37f97
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 22d09c15f1d9ccb167a90d30cdbab233bc465a1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/doc/tutorials/debugging/qml_debugging.rst | 32 | ||||
-rw-r--r-- | sources/pyside6/doc/tutorials/index.rst | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/sources/pyside6/doc/tutorials/debugging/qml_debugging.rst b/sources/pyside6/doc/tutorials/debugging/qml_debugging.rst new file mode 100644 index 000000000..474abe50b --- /dev/null +++ b/sources/pyside6/doc/tutorials/debugging/qml_debugging.rst @@ -0,0 +1,32 @@ +Using Qt Creator's QML Debugger for a PySide6 QML Application +************************************************************* + +Besides the C++ debugger, Qt Creator provides a `QML debugger`_ which lets you +inspect JavaScript code. It works by connecting to a socket server run by the +``QmlEngine`` instance. The port is passed on the command line. To enable it, +add the below code to your QML application: + +.. code-block:: python + + from argparse import ArgumentParser, RawTextHelpFormatter + + ... + + if __name__ == "__main__": + argument_parser = ArgumentParser(...) + argument_parser.add_argument("-qmljsdebugger", action="store", + help="Enable QML debugging") + options = argument_parser.parse_args() + if options.qmljsdebugger: + QQmlDebuggingEnabler.enableDebugging(True) + app = QApplication(sys.argv) + + +For instructions on how to use the QML debugger, see +`Debugging a Qt Quick Example Application`_. + +.. note:: The code should be removed or disabled when shipping the application + as it poses a security risk. + +.. _`QML debugger`: https://doc.qt.io/qtcreator/creator-debugging-qml.html +.. _`Debugging a Qt Quick Example Application`: https://doc.qt.io/qtcreator/creator-qml-debugging-example.html diff --git a/sources/pyside6/doc/tutorials/index.rst b/sources/pyside6/doc/tutorials/index.rst index 920e646c4..72b72fc3f 100644 --- a/sources/pyside6/doc/tutorials/index.rst +++ b/sources/pyside6/doc/tutorials/index.rst @@ -202,4 +202,5 @@ Debug a PySide6 Application :maxdepth: 1 debugging/mixed_debugging.rst + debugging/qml_debugging.rst |