Getting Started on Linux
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.
To start development with Qt Quick Ultralite you must have the following tools installed:
- GNU Compiler Collection v7.4.0 or newer
- GNU Make
- X C Binding, xinerama extension library (libxcb-xinerama0)
- CMake 3.15 or newer (you can install it using the Qt Online installer)
All these prerequisites can be installed using the following commands:
sudo apt update sudo apt install build-essential libxcb-xinerama0 cmake
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:
export Qul_DIR=<INSTALL_ROOT> cd $Qul_DIR/demos/thermo mkdir build_linuxqt cd build_linuxqt 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:
cmake --build . --target thermo_big --config Release
Once the thermostat application is built, try to run it:
The following sections provides instructions to set up Qt Creator for Qt for MCUs development on the Linux platform only. For details about configuring Qt Creator for development on MCU boards, refer to Qt Creator documentation.
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:
- Select Help > About Plugins and choose the MCU Support plugin from the list.
- Restart Qt Creator to apply changes
To build and run your application on MCUs, you must create a kit:
- Select Tools > Options > Devices > MCU
- If not already set, provide the path to the Qt for MCUs installation directory.
- Select a Target supported by the Qt for MCUs SDK. For example, Qt for MCUs dev - Desktop.
- In the Requirements section, ensure that the platform-specific requirements are met.
- Select Automatically create kits for all available targets on start to create kits automatically.
Note: You could also manually create/remove kits using Create Kit and Remove Kit.
- Click Apply and restart Qt Creator if you choose to create kits automatically.
Note: The 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.
To open the Thermostat project:
- Select File > Open File or Project...
- Open the CMakefiles.txt file from
- Select Qt for MCUs dev - Desktop kit.
- Click Configure Project to finish.
The project should be configured.
Now, you are ready to go!
Note: For more information, refer to the Qt Creator manual.
You can debug the C++ code generated from your application using the Qt Creator. To make debugging a bit easier, in the generated code you will see snippets of the QML, from which the C++ code was generated.
Available under certain Qt licenses.
Find out more.