PySide6.QtQml.QQmlDebuggingEnabler¶
- class QQmlDebuggingEnabler¶
The
QQmlDebuggingEnablerclass provides methods to enable debugging or profiling.Details
Usually QML debugging and profiling is enabled by passing
QT_ENABLE_QML_DEBUGvia CMake orCONFIG+=qml_debugvia qmake when building your application. At run time, the application generally parses any-qmljsdebuggercommand line arguments to actually start debugging or profiling.You can instead handle these tasks manually by using the methods in this class.
Synopsis¶
Methods¶
def
__init__()
Static functions¶
def
setServices()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- class StartMode¶
Defines the debug connector’s start behavior. You can interrupt QML engines starting while a debug client is connecting, in order to set breakpoints in or profile startup code.
Constant
Description
QQmlDebuggingEnabler.StartMode.DoNotWaitForClient
Run any QML engines as usual while the debug services are connecting.
QQmlDebuggingEnabler.StartMode.WaitForClient
If a QML engine starts while the debug services are connecting, interrupt it until they are done.
- __init__([printWarning=true])¶
- Parameters:
printWarning – bool
Note
This function is deprecated.
- static connectToLocalDebugger(socketFileName[, mode=QQmlDebuggingEnabler.StartMode.DoNotWaitForClient])¶
- Parameters:
socketFileName – str
mode –
StartMode
- Return type:
bool
Enables debugging for QML engines created after calling this function. The debug connector will connect to a debugger waiting on a local socket at the given
socketFileNameand block the QML engine until the connection is established ifmodeisWaitForClient. Ifmodeis not specified it will not block. You can only start one debug connector at a time. A debug connector may have already been started if the -qmljsdebugger= command line argument was given. This method returnstrueif a new debug connector was successfully started, orfalseotherwise.- static debuggerServices()¶
- Return type:
list of strings
Retrieves the plugin keys of the debugger services provided by default. The debugger services enable a debug client to use a Qml/JavaScript debugger, in order to set breakpoints, pause execution, evaluate expressions and similar debugging tasks. Returns List of plugin keys of default debugger services.
- static enableDebugging(printWarning)¶
- Parameters:
printWarning – bool
Enable debugging or profiling. If
printWarningistrue, print the following warning to stderr:QML debugging is enabled. Only use this in a safe environment.
This method is automatically called at startup if
QT_ENABLE_QML_DEBUGorCONFIG+=qml_debugis passed at build time.This method needs to be called one way or another before starting a debug connector of any kind. Otherwise the connector will refuse to start.
- static inspectorServices()¶
- Return type:
list of strings
Retrieves the plugin keys of the inspector services provided by default. The inspector services enable a debug client to use a visual inspector tool for Qt Quick. Returns List of plugin keys of default inspector services.
- static nativeDebuggerServices()¶
- Return type:
list of strings
Retrieves the plugin keys of the debug services designed to be used with a native debugger. The native debugger will communicate with these services by directly reading and writing the application’s memory. Returns List of plugin keys of debug services designed to be used with a native debugger.
- static profilerServices()¶
- Return type:
list of strings
Retrieves the names of the profiler services provided by default. The profiler services enable a debug client to use a profiler and track the time taken by various QML and JavaScript constructs, as well as the QtQuick SceneGraph. Returns List of plugin keys of default profiler services.
- static setServices(services)¶
- Parameters:
services – list of strings
Restricts the services available from the debug connector. The connector will scan plugins in the “qmltooling” subdirectory of the default plugin path. If this function is not called before the debug connector is enabled, all services found that way will be available to any client. If this function is called, only the services with plugin keys given in
serviceswill be available.Use this method to disable debugger and inspector services when profiling to get better performance and more realistic profiles. The debugger service will put any JavaScript engine it connects to into interpreted mode, disabling the JIT compiler.
- static startDebugConnector(pluginName[, configuration=QVariantHash()])¶
- Parameters:
pluginName – str
configuration – Dictionary with keys of type .QString and values of type QVariant.
- Return type:
bool
Enables debugging for QML engines created after calling this function. A debug connector plugin specified by
pluginNamewill be loaded and started using the givenconfiguration. Supported configuration entries and their semantics depend on the plugin being loaded. You can only start one debug connector at a time. A debug connector may have already been started if the -qmljsdebugger= command line argument was given. This method returnstrueif a new debug connector was successfully started, orfalseotherwise.- static startTcpDebugServer(port[, mode=QQmlDebuggingEnabler.StartMode.DoNotWaitForClient[, hostName=""]])¶
- Parameters:
port – int
mode –
StartModehostName – str
- Return type:
bool
Enables debugging for QML engines created after calling this function. The debug connector will listen on
portathostNameand block the QML engine until it receives a connection ifmodeisWaitForClient. Ifmodeis not specified it won’t block and ifhostNameis not specified it will listen on all available interfaces. You can only start one debug connector at a time. A debug connector may have already been started if the -qmljsdebugger= command line argument was given. This method returnstrueif a new debug connector was successfully started, orfalseotherwise.