qbs QML debugging doesn't work - qt

After migration to QBS my QML debugging stopped working.
I made sure that:
I'm building a debug build, C++ debugging works
I've checked "Enable QML Debugging" in qt creator's Project tab
I've even tried to add qbs properties manually Qt.declarative.qmlDebugging:true Qt.quick.qmlDebugging:true
Still QtCreator says:
Some breakpoints cannot be handled by the debugger languages currently active, and will be ignored.
QML debugging works with an old .pro
My system:
Linux archlinux 4.15.7-1-ARCH
QBS 1.10.1
Qt 5.10.1

It's not so clear, but there are TWO checkboxes.
One at the build step, and another one in the run step.
So to get QML Debugging working you have to check both of them.
I missed the one under the "Projects->Run->Debugger settings->Enable QML"

The upcoming 4.6 release of Qt Creator should be smarter about this and auto-enable the checkbox in the run settings if the one in the build settings gets enabled.

Related

Cannot step into Qt source

I create a Qt project,build the project with msvc2017-32bit kit, and debug the project in Qt Creator. The problem is I can not step into the Qt functions. I can stop at break-points in my own source code, but cannot stop at break-points in files in Qt src directory. When I step into a Qt function, a message Stopped: "end-stepping-range" appears by the debugging buttons. Why could this happen?
According to #user13088490's suggestion, I installed the debugger tools for windows in windows 10 SDK, but the problem persists.
Follow the instructions from Qt here.
For Mac, the instructions are:
In Projects->Build&Run->Run->Run Settings->Run, select "Use debug version of frameworks".
There are different instructions for Windows, but I have not tried it yet.
You probably also need to have QT sources installed.
Go to the MaintenanceTool and check if Qt Creator 4.15.2 CDB Debugger Support and Debugging Tools for Windows has been selected.
I run Qt on Windows, although a different compiler than you, and you can set the debug target paths by going to Tools->Options->Debugger. From here you can click a button Add Qt sources.... Below is an image of my setup and this works for me.

Why I cant debug qml from qt creator?

I installed the last Qt 5.12.2 . Then I open the cmake project via Qt Creator.
First I see a huge count on the intellisence issues: from "udeclared identifies of nullptr" to errors with each type "unknown type name".
The build proceeded successfully and I receive correct binary.
But any breakpoint marked as "Unclaimed breakpoint" and I cant debug any .qml (the .cpp could be debug)
So why it happens and how to debug the QML? (this future is still supported?)
UPDATE: The "QQmlDebuggingEnabler enabler;" and "doc.qt.io/qt-5/qtquick-debugging.html" doesnt helps :(
UPDATE2: #Amfasis -
I created a CMake-based Qt Quick project, and it shown that it supports QML/JS debugging. I checked the CMakeLists.txt, and found one relevant line:
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
So I think if you'd like to debug your CMake-based Qt Quick project, you should also add this line to your CMakeLists.txt.
And don't forget to check on enable QML in the project setting within the sector of debugging setting.

Debugging QML with Qt creator

I have a Qt (5.8.0) project using QML files. I would like to set breakpoints in the QML file using Qt creator (4.2.1) so I can follow the flow. However I cannot get it to work. I have enabled "Enable QML debugging and profiling" in the qmake build step and "Enable C++" and "Enable QML" in the run step.
The breakpoints in the C++ code are hit, but the QML are ignored. When starting I get the following message:
QDeclarativeDebugServer: Ignoring
\"-qmljsdebugger=port:42715,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector\".
Debugging has not been enabled.
When I try to debug QML files in demo projects like "Calendar" with the same kit it does work and breakpoints are hit.
Any ideas?
Did you enable the QML Debugger in your code?
I remember putting something like this into my code:
For Qt4:
#include <QtDeclarative/qdeclarativedebug.h>
QDeclarativeDebuggingEnabler qmldbg;
or in case of Qt5:
#include <QQmlDebuggingEnabler>
QQmlDebuggingEnabler enabler;
Also QML debugging needs to be activated in the Execution Settings:
I had to remove a package from my .pro file:
#CONFIG += qtquickcompiler
With this line commented out and confirming my project's build steps: "Enable QML debugging and profiling" was checked, the breakpoints worked.
I found a way to make it work. Looks like I am using the combination of Qt5, while using the Declarative package and Qt Quick 1.1. When I removed the Declarative package and instead use the qml and quick packages (Qt+=qml quick) and updated my software to use Qt Quick 2.2, the breakpoints were hit (also using the #include as suggested by the answer of Jens)

Permanently disable the 'run in terminal' option

I created a plain C++ with Qt program. I failed to achieve any application output. The fix for me was to disable the 'run in terminal' option in Qt Creator.
Anyway, I'd rather use the built-in application output pane for output than a separate terminal. I know I can change it per build configuration, but can make it disabled by default?
I'm using Qt Creator 3.4.2
Default state of this option depends on your project file.
For qmake, if you have CONFIG += console - then this checkbox is checked.
For qbs it's consoleApplication: true
If you want different behavior for new projects - you can create your own Qt Creator project wizard template.

Debugging a version of Qt Creator and plugins all built from source

My goal is to be working on / debugging qt creator plugins and, maybe, editing / debugging qt creator source code. Towards this end I've tried a couple of things:
Downloading source for the qt sdk and qt creator, compiling each, and then making a qt creator plugin project and hooking everything together by hand. This got complicated pretty quickly (I tried to keep my plugin project outside the qt-creator/src/plugin/ folder) and doesn't really get me to a nice spot in terms of debugging.
Using an installed version of the qt creator to open the qtcreator.pro that came along with the source, adding a qt creator plugin as a sub project, and building everything from the already installed version of qt creator.
I like the second approach a lot because I have control over everything but I can rely on qt creators tools that make projects, enhance debugging, etc. There's just one small problem...
When I run my shiny new build of qt creator (with my plugin project) from inside the installed version all I get is a popup called "qtcreator_process_stub" that says "This is an internal helper of Qt Creator. Do not run it manually. Press to close this window..."
So I'm not really sure how to debug my build of qt creator from my instance of qt creator. Any ideas? Note: if I run the generated Qt Creator.app I get a functioning instance of qt creator with my plugin loaded properly.
I believe this was a versioning problem. I had an older version of the ide installed and was using it to build and debug a newer version of the ide.
I was able, in the older ide, to launch and debug the new ide as an external process through the debug menu... but that was mildly annoying.
Once I installed a new version of the ide I was able to debug like normal.

Resources