Debugging Qt Quick applications
We will use the Weather_QML
project from Chapter 7, Parsing JSON and XML Documents to Use Online APIs, as a demonstration program to show how to debug a Qt Quick application.
First, we need to ensure that QML debugging is enabled. Open the Weather_QML
project in Qt Creator. Then, perform the following steps:
- Switch to the Projects mode.
- Expand the qmake step in Build Steps.
- Check Enable QML debugging if it's not checked.
Tip
Debugging QML will open a socket at a well-known port, which poses a security risk. Anyone on your network could connect to the debugging application and execute any JavaScript function. Therefore, you have to make sure there are appropriate firewall rules.
The same procedure is used to start QML debugging, which is to navigate to Debug | Start Debugging | Start Debugging, or click the Debug button, or just press F5. It may trigger a Windows Security Alert, shown in the following screenshot. Don't forget to click on the Allow access...