How to disable QML Debugger in Qt Creator entirely? - qt

How can I disable QML debugging in QtC entirely? I can disable it from the run settings, but for some reason it is always switched (back) on.
I do not use QML in the UI, but I use the JavaScript engine for other purposes (pure guess, is that why it is always "on"?). But I entirely want to disable QML debugging, as this always "hangs" and is not needed (at my place).
How can I do that?
I can uncheck "Enable QML" but is always checked "on" again when I restart QtC.

Uncheck the option Enable QML debugging and profiling from the Build Steps in the Build Settings

Just some details:
You are correct it is here, when I check QML CONFIG+=qml_debug is added to the cmd line. Wonder if the CONFIG-=qml_debug in the .pro reverts that(the idea is good)
P:.....in\qmake.exe H:\Pr...pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" && P:/Qt/Tools/QtCreator/bin/jom.exe qmake_all

Related

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)

qbs QML debugging doesn't work

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.

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.

Running debug mode in Qt Creator

I am trying to compile some demo code (specifically, the pcl_visualizer demo that comes with the Point Cloud library). When running debug by clicking the green arrow with the magnifying class, I get the following errors:
This does not seem to be a "Debug" build.
Setting breakpoints by file name and line number may fail.
Section .debug_info: Not found.
Section .debug_abbrev: Not found.
Section .debug_line: Not found.
Section .debug_str: Not found.
Section .debug_loc: Not found.
Section .debug_range: Not found.
Section .gdb_index: Not found.
Section .note.gnu.build-id: Found.
Section .gnu.hash: Found.
Section .gnu_debuglink: Not found.
Furthermore, none of the breakpoints I have inserted are breaking the program, and they all have little hourglasses hovering over.
In Projects, the Debug mode is selected in Build Settings.
Why does my code not seem to be debugging correctly?
Some projects automatically build debug mode and allow to run it individually. You can then pick it in the bottom left Run selection menu.
Other projects require you to specifically do a debug build.
For example: Kdenlive requires you to run CMake again with the following parameter added:
-DCMAKE_BUILD_TYPE=Debug
You can re-run CMake in the Projects view.
For newer versions of QT:
Go to "Projects" in the top left of the screen, an icon with a wrench that turns green when you select it.
If not already "clicked", click on "Build" under the named Kit (I have "desktop" as my kit). This should be immediately below "Build & Run" on the left side.
Under Build Settings at the top center, should have "Edit build configuration" with a drop down next to it. If you can select "Debug" from the drop down then do it, otherwise click "Add" in the drop down next to it and select "Debug".
Drop down some and see "Key" on the left side of a table of "Key"s with "Value"s, look farther right and see "Advanced" with a square, check the square to get the advanced Key-Value pairs.
Look for "CMAKE_BUILD_TYPE" and click "Edit" in the far right, change the drop down for the value matched to the key CMAKE_BUILD_TYPE to "debug".
Now in the bottom left, change the build configuration to "debug" and build... should work!
You may have to Clean the project and possibly clear cmake configuration under the Build tab.
Another cause for the "does not appear to be a debug build" message is running gdb using the cdb engine. to check go to tools->options->build and run->kits and select the kit you are using. next go to the debugger line, choose edit, and make sure you have the right engine for your debugger.
On linux using the 'Qt Maintenance tool' to install the 'Qt Debug Information Files' solved this for me
I've got the same message because the build type was set to release. On Qt Creator 3.3.0 on the bottom left, on top of the play symbol i have a pc icon with the build type. click on that icon and select debug.
I needed to 'run qmake' too from the menu build.
For nasm users with QT5.9.1 and nasm 2.14 the problem will be gone by using:
nasm -felf64 -FDwarf -g
I know it's not c/c++ related but works very well in QT
To change the Build Configuration in QT Creator :(at time of writing : 4.13.3)
Just make sure you have selected this as Debug so that it would then run in debug mode.
I managed to solve this by unchecking "Warn when debugging Release builds" in the Debug settings General tab, as in the article:
http://www.kdab.com/qt-on-android-episode-2/

Qt - Qml debugging is enabled. Only use this in a safe environment

I'm trying to run a very simple program that just closes the window when clicking the `exit button, but get the following output provided that the application window that contains the button does not show up:
Starting C:\Users\Ola\Desktop\signal_slot1-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2008__Qt_SDK__Debug\debug\signal_slot1.exe...
Qml debugging is enabled. Only use this in a safe environment!
What should I do in this case?
You have enabled QML debugging (actually it's on by default), this opens a port to the Javascript interpreter that is running the QML so you can get debug output from it. Obviously this creates a security hole, so it should be turned off when not being used in safe place (it's turned off automatically when you release compile). This warning is to remind you of that.
If you are not using QML, turn it off anyway. You can turn it off in the project's options page, where the build settings are (it's a check box in the qmake area).
Assuming you use Qt Creator:
If you select the Release-Build type the QML debugging will be disabled. To do this, select the build type on the bottom left corner above the "run" button and choose "release".
Manually, there is an option passed to qmake (either in the .pro file or via command line arguments) named
CONFIG+=qml_debug
which enables qml debugging.
If you omit that, it should be disabled.
You can change it to release mode if you want to and that would solve the problem
but I recommend you to change between MSVC and MinGW and check which one is going to work.
Project->Build and Run-> and choose what you need.

Resources