What software Qt/QML pieces are needed to compile in an app to be able to debug/profile QML?
My current app is build using cmake and runs on a embedded device. Furthermore, I'm starting to use Qt 4.8.3 (until now 4.7.0).
I would like to use these fancy/cool features (for an embedded developer):
http://doc.qt.digia.com/qtcreator/creator-qml-performance-monitor.html
I've searched trough qt-project looking for help, but I haven't got clear what are the steps needed when you want to debug/profile a remote app, with a customize build environment.
So, I would like to know if it is needed any of the following steps, and in positive case, what is in fact the needed code.
Any help, link, etc is welcomed.
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: Debug JavaScript functions.
Creating and Running QML Projects For simple UI files such as this one, select File > New File or Project > Application (Qt Quick) > Qt Quick Application - Empty from within Qt Creator. Pressing the green Run button runs the application. You should see the text Hello, World! in the center of a red rectangle.
Setting Up QML Debugging The process of setting up debugging for Qt Quick projects depends on the type of the project: Qt Quick UI or Qt Quick Application. To debug Qt Quick UI projects: Select Projects, and then select the QML check box in the Run Settings, to enable QML debugging.
Checking the docs all given answers seem to be unnecessary. Further it hardcodes debug code in releases. I have no clue why QQmlDebuggingEnabler
would be necessary, but if you check the code here and here, you will recognize, that the instatiation of QQmlDebuggingEnabler
is not necessary. Just include QQmlDebuggingEnabler
and set the QT_QML_DEBUG
flag e.g. like this (CMake)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG ")
However according to the docs QQmlDebuggingEnabler
is not necessary.
Furtermore: profiling unoptimized code makes no sense.
For me setting QT_QML_DEBUG
as flag and checking the checkbox for QML debugging is sufficient.
I'm using Qt 5, and it got even easier. Just this one step was required on my side to do QML profiling:
#include <QQmlDebuggingEnabler>
...
QQmlDebuggingEnabler enabler;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With