Solved Enabling QML debugging with Pyside2 5.11.2
Rguessford last edited by
I'm trying to enable the qml/js debugger in my PySide2 app so I can connect the QtCreator Debugger to it.
I've done this successfully in PyQt5 where I had to build the wrapper with qml debugging enabled, and then instantiate the QApplication with the argument '-qmljsdebugger=port:3768,block'. This paused my app until I connected the QtCreator debugger to it via Debug > Start Debugging > Attach to QML Port.
I've switched to PySide2, and it doesn't seem there is the same option to build PySide2 with debugging enabled. When I try to instantiate the QApplication with the debugger argument, I get this message: "QML Debugger: Ignoring ..... Debugging has not been enabled." which was the message I got when running against non-debugging enabled PyQt5.
I did notice that PySide2 has a "QQmlDebuggingEnabler" class, but the documentation is very sparse. Calling QQmlDebuggingEnabler.StartTcpDebugServer(3768) before instantiating my QApplication gets rid of the "Debugging has not been enabled" message, but I'm unable to connect to the debugger with QtCreator.
Do I need to build PySide2 with the QT_QML_DEBUG flag somehow? Is there a way I can do it without having to rebuild PySide2 by using QQmlDebuggingEnabler?
Rguessford last edited by Rguessford
Figured out my issue. I just needed to instantiate a QQmlDebuggingEnabler object. Calling QtQml.QQmlDebuggingEnabler() before instantiating my QApplication was enough.
@Rguessford I know you posted this response over two years ago, but I am needing to do the same thing and your question/answer is the closest I can find to actually starting the QML Debugger with a PySide2 app. Can you describe in a little more detail for how you were able to get the debugger to work? After adding the QtQml.QQmlDebuggingEnabler() in your main file, did you have to run your python file from the command line with any special flags? Or did you run it from QtCreator? If you ran it from QtCreator, how did you go about it? I cannot seem to get QtCreator to find/connect to my app.
Alexander Petermann last edited by
@Rguessford I would also be interested to get the Qt Creator Debug button to work for both, Python and QML debugging, at the same time. Even with QQmlDebuggingEnabler instantiated.
I think, I'm stuck at the same as @Jeff-B-0