This topic provides instructions to compile a Qt Quick Ultralite project for Qt Desktop. The Qt Desktop environment lets you quickly preview the application you are developing, making the process of creating the application faster.
As a reference project let's use the thermostat demo provided with Qt for MCUs.
Currently, Windows 10 64bit is the only supported development host environment. Additionally, you must have the following tools installed, to build any Qt Quick Ultralite project:
In addition, install Qt for MCUs using the Qt online installer that is available for download on Qt account .
Important: This guide uses <INSTALL_ROOT> as the reference to directory the Qt for MCUs is installed in.
To configure the project, use the CMake command from the command line. First, navigate to the <INSTALL_ROOT>\demos\thermo folder and enter the following commands:
C:\Users\John> set Qul_DIR=<INSTALL_ROOT> C:\Users\John> cd %Qul_DIR%\demos\thermo <INSTALL_ROOT>\demos\thermo> mkdir build_winqt <INSTALL_ROOT>\demos\thermo> cd build_winqt <INSTALL_ROOT>\demos\thermo\build_winqt> cmake .. -DQUL_PLATFORM=Qt -Ax64
The above commands will check the prerequisites and create the build setup, which includes generating visual studio project files.
To build, use the following command:
<INSTALL_ROOT>\demos\thermo\build_winqt> cmake --build . --target thermo_big --config Release
Once the thermostat application is built, try to run it. As it is built as a Qt application for Windows, it requires the Qt runtime libraries in the
. Qt for MCUs does not require you to install the standard Qt for desktop, instead it provides you with all the necessary libraries. You must ensure that these libraries are in your
<INSTALL_ROOT>\demos\thermo\build_winqt> set PATH=%Qul_DIR%\bin;%PATH%
Now we can run the application:
To configure the project, follow instructions in the 命令行设置 章节。
To work with your project using Microsoft Visual Studio, open the solution created by CMake from the build_winqt 文件夹。
Now, you should see the solution tree structure.
As this is a Windows Qt project, it requires Qt's runtime libraries to run. To make them available for the built application, you must set the runtime environment. To do this:
After this step (assuming %Qul_DIR% was set to C:\QtForMCU\1.1.0) the project properties window should look like this:
Apply the changes, build the application, and run it. You should see on the screen the 恒温器演示 .
The following sections provides instructions to set up Qt Creator for Qt for MCUs development on the Windows platform only. For details about configuring Qt Creator for development on MCU boards, refer to Qt Creator 文档编制 .
To develop for MCUs using the Qt Creator IDE, the MCU plugin is required. The Qt online installer enables it by default when you install the Qt for MCUs SDK.
To enable or disable the plugin, follow these instructions:
To build and run your application on MCUs, you must create a kit:
注意： You could also manually create/remove kits using Create Kit and Remove Kit .
注意： Automatically create kits for all available targets on start option is available from Qt Creator v4.14 onwards. On older versions of Qt Creator, you have to explictly create or remove kits using Create kit or Remove kit .
The project should be configured.
Now, you are ready to go!
注意： For more information, refer to the Qt Creator 手册 .
You can debug the C++ code generated from your application using the Qt Creator or Microsoft Visual Studio. To make debugging a bit easier, in the generated code you will see snippets of the QML, from which the C++ code was generated.