Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Enabling QML debugging with Pyside2 5.11.2
QtWS25 Last Chance

Enabling QML debugging with Pyside2 5.11.2

Scheduled Pinned Locked Moved Solved Language Bindings
pyside2python2qtcreatordebuggerqml profiler
4 Posts 3 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rguessford
    wrote on 16 Aug 2018, 16:43 last edited by
    #1

    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?

    thanks!

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rguessford
      wrote on 16 Aug 2018, 17:15 last edited by Rguessford
      #2

      Figured out my issue. I just needed to instantiate a QQmlDebuggingEnabler object. Calling QtQml.QQmlDebuggingEnabler() before instantiating my QApplication was enough.

      J 1 Reply Last reply 3 Dec 2020, 18:37
      1
      • R Rguessford
        16 Aug 2018, 17:15

        Figured out my issue. I just needed to instantiate a QQmlDebuggingEnabler object. Calling QtQml.QQmlDebuggingEnabler() before instantiating my QApplication was enough.

        J Offline
        J Offline
        Jeff B. 0
        wrote on 3 Dec 2020, 18:37 last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Alexander Petermann
          wrote on 18 Jan 2021, 08:03 last edited by
          #4

          @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

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved