clarification on debugging QML

  • Hi all -

    According to this page, I believe I should be able to set a breakpoint within a function declared in a QML file.


    So, I attempted to do so here:


    But the app doesn't stop here. Any idea what step I've missed?


  • Moderators

    I suspect you need to place it either before or after that line, but it's only a guess. I haven't used QML debugger in ages.

  • Moderators

    @mzimmers said in clarification on debugging QML:

    According to this page, I believe I should be able to set a breakpoint within a function declared in a QML file.

    True and it works as you can see, I'm breaking inside the function:


    have you set "QML debugging and profiling" to Enabled, inside the project settings?
    Are you building and running a debug build, are you sure the debugger is attached?

  • @J-Hilk "QML debugging and profiling" is set to Enabled.
    I'm building and running a debug configuration.
    I was under the impression that the debugger was already invoked when I pressed the debug button in Creator. I tried attaching after-the-fact, and got this message:

    process 14947 is already traced by process 14945
    08:03:57: Debugging has finished

    I'd assume from the message that the debugger is already "attached."


  • BTT...anyone have any ideas on this? Thanks...

  • @mzimmers
    I put a breakpoint in my qml in my project and ran the project under debug. When the function was called it broke execution at that point. I have never adjusted anything in Qt Creator for this.

    Considering that you cannot get refactoring to work either, maybe try updating Qt Creator? I don't know what the problem might be as it "just worked" for me. Sorry I cannot be more helpful.

  • @fcarney I'm already running 4.14.0 of Creator, so that's not the problem.

    I'm wondering whether there's some plugin or option or something that I need, that I don't have. I'll just leave this open for a bit, and see if any of the other mavens have ideas.


  • I am running Qt Creator 4.13.3. So your version is even newer. Hmmm...
    The project I tested was a Qt 5.15.2 project. What version of Qt is your project running? Trying to look for differences in setup.

  • Hello,

    I think you might have created a release build that does not contain debug information. A GNU Compiler Collection (GCC) debug build has the -g option on the compiler command line. Check the option is present in the Compile Output. In the case it does not, go to build settings in the proyects mode and set this option.

  • I'm running Qt 5.14.2. I tried to use 5.15.2, but this app has some deprecated syntax, so it won't build.

    GabrielRR: breakpoints in C++ work fine; it's just those in QML files that don't work.

    When I hover over the breakpoint, the message box refers to it as an "unclaimed breakpoint," FWIW.

  • BTT...I'll take any suggestions, no matter how far-fetched. Thanks...

    EDIT: I don't think I mentioned that this is a CMake project. I just tried a qmake project, and the debugger and other tools work fine. Do CMake projects need special attention for using the deubgger?

  • I discovered my error: I hadn't enabled QML debugging in the run settings for my project. (The documentation does say to do this, though it's kind of subtle.) Now I can break and examine variables.

    Thanks to all who looked at this.

Log in to reply