Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to debug QML from Visual Studio?

I have a QT project that loads a QML project. I've have no problem debugging the QML part of the program when I run it from QT Creator. I've added

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG ")

to my CMakeLists.txt and checked the "Enable QML" under "Debugger Settings" in "Project->Run"

But I would like to debug from Visual Studio, since that is the environment we usually work in.

Is it possible to manually do what QT Creator does when you check the "Enable QML" box, to activate debugging from Visual Studio? Attach to some process or similar?

I've tried to figure out what the "Enable QML" box actually does. But I've not been able to find any good explanation about this.

We use CMake to build, MSVC as compiler and CDB as debugger. The projects are in QT5.5 and QT Quick 2. Visual Studio is version 2015 Professional and QT Creator is version 4.1.0.

like image 250
mattsson Avatar asked Nov 04 '16 14:11

mattsson


People also ask

How do I debug a QML file?

In the Run Settings, Debugger Settings section, select the Enable QML check box to enable QML debugging. Select Build > Rebuild Project to clean and rebuild the project.

Is QML open source?

QMK (Quantum Mechanical Keyboard) is an open source community centered around developing computer input devices. The community encompasses all sorts of input devices, such as keyboards, mice, and MIDI devices.

What is component onCompleted in QML?

This can be used to execute script code at startup, once the full QML environment has been established. The onCompleted signal handler can be declared on any object. The order of running the handlers is undefined. Rectangle { Component. onCompleted: console.

When will QML debugging be available in Qt vs tools?

As mentioned, the QML debugging feature of the Qt VS Tools will be available in the next version, scheduled for release in the Visual Studio Marketplace later this year. A preview version will shortly be available for download on the Qt website; we'll post a quick update here when it is available.

How do I enable or disable QML debugging?

QML debugging is enabled by default for any Qt QML application. It is possible to disable QML debugging, and revert to native-only debugging, by opening the Qt project settings dialog and setting the "QML Debug" option to "Disable". In this dialog, it is also possible to change the port that is used by the QML debugging runtime.

Should I use Qt Creator or Visual Studio Code?

The short answer to this question is: Use both. While Code is a great development tool, it is not meant to replace a full IDE that offers in-depth support and tools for a specific framework. In contrast to Qt Creator, Visual Studio Code strictly focuses on the necessary tools for efficient source code editing, and it excels at that.

How do I enable debugging in Visual Studio Code?

You can also use the keyboard shortcut Ctrl+Shift+D. The Run view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings. If running and debugging is not yet configured (no launch.json has been created), VS Code shows the Run start view.


1 Answers

Since Qt Visual Studio tools 2.3, released in Oct 2018, the QML debugger is included and usable from Visual Studio :)

like image 150
Kuba hasn't forgotten Monica Avatar answered Sep 20 '22 03:09

Kuba hasn't forgotten Monica