Debugging Qt Quick Projects
For an example of how to debug Qt Quick Projects, see Debugging a Qt Quick Example Application.
Note: In this section, you are using advanced menu items. These are not visible by default. To toggle the visibility of advanced menu items, see Customizing the Menu.
Setting Up QML Debugging
To debug Qt Quick UI projects, select the Enable QML check box in the Debugger Settings in Projects mode Run Settings.
Starting QML Debugging
To start the application, choose Debug > Start Debugging > Start Debugging of Startup Project or press F5. Once the application starts running, it behaves and performs as usual. You can then perform the following tasks:
To debug already running applications:
- Start the application with the following arguments:
port(mandatory) specifies the debugging port,
ip address(optional) specifies the IP address of the host where the application is running, and
block(optional) prevents the application from running until the debug client connects to the server. This enables debugging from the start.
Note: Setting breakpoints is only possible if the application is started with block mode.
- Select Debug > Start Debugging > Attach to QML Port.
Choose the kit configured for the device where the application to be debugged is running. The port number to use is displayed in the standard output when the application starts.
You can use the Qt Design Studio Debug mode to inspect the state of your application while debugging. You can interact with the debugger by:
- Viewing call stack trace
- Setting breakpoints
- Viewing local variables and function parameters
- Evaluating Expressions
While the application is running, you can use the Locals view to explore the QML item structure.
To keep the application visible while you interact with the debugger, select Debug > Show Application on Top.
You can view a QML item in the Locals view in the following ways:
- Expand the item in the object tree.
- Select the item in the code editor.
- Select Debug > Select to activate selection mode and then click an item in the running application.
To change property values temporarily, without editing the source, double-click them and enter the new values. You can view the results in the running application.
Inspecting User Interfaces
When you debug complex applications, you can jump to the position in code where an item is defined.
In the selection mode, you can click items in the running application to jump to their definitions in the code. The properties of the selected item are displayed in the Locals view.
You can also view the item hierarchy in the running application:
Double-click an item in the running application to cycle through the item stack at the cursor position.
To switch out of the selection mode, toggle the Select menu item.
To move the application running in Qt QML Viewer to the front, select Debug > Show Application on Top.
You can change property values temporarily, without editing the source, and view the results in the running application. You can change the property values permanently in the Properties view.
Applying QML Changes at Runtime
When you change property values in the QML Debugger Console or in the Locals or Expression view, they are immediately updated in the running application, but not in the source code.
Available under certain Qt licenses.
Find out more.