C
Develop your First Application
This topic provides instructions to develop the classic hello world application assuming that you have setup the development host. It lets you explore the Qt for MCUs offering by creating this simple application using the Qt Creator's new project template, which is designed specifically for the MCU platforms.
Creating the project
Now, assuming that your development environment is ready, the following list guides you through the process:
- Open Qt Creator and select File > New file or Project.
- Choose the Application (Qt for MCU) > MCU Support template.
- Select Choose and give a Name to the project.
- Select Next and follow the wizard to create the project.
After you select Finish on the project wizard, your project explorer looks like this:
Notice that the project explorer (1) lists all the files created by the wizard, including the HelloMCU.qml
file. The code editor view (2) shows the contents of the QML file, which contains a Rectangle with a Text item in it.
Modify the Text item
The Text item's font.pixelSize
is set to 14
by default. Try increasing the font size to 18
and also color
to teal
for example. You could also set a background color, by setting the color
property of the Rectangle. This is how the QML file looks after you have made these changes:
import QtQuick 2.0 Rectangle { width: 480 height: 272 color: "black" Text { anchors.centerIn: parent color: "teal" text: "Hello World!" font.pixelSize: 18 } }
Now, run the application to see how it looks.
Run on a target hardware
The application is configured to run on the desktop, but you can also retarget it run on a NXP hardware for example. Before you do so, ensure that you have necessary setup to run on any of the supported hardware platforms. To get started on any of these platforms, follow instructions in these topics:
- Getting Started on NXP
- Getting Started on STM
- Getting Started on Renesas
- Getting Started on Infineon/Cypress
In addition, configure Qt Creator to build and run applications on these targets. For more details, refer to Qt Creator manual.
Once the setup is ready, select Run or use the Ctrl + R keyboard shortcut to see your application running on the target.
Available under certain Qt licenses.
Find out more.