The first stage in writing a Qt HMI is to create a project in Qt Creator and add the files that define the UI, application
entry point, and how to package the project components.
In particular, the project will contain:
- A Qt Project file (QtHmi.pro) to store the project configuration settings
- A QML file (main.qml) to define the main UI elements for the application
- A QRC file (resources.qrc) to package the project resources into the binary
- A CPP file (main.cpp) to contain the entry-point function for starting the application
To create a Qt project and start defining its project file:
-
Launch Qt Creator.
-
In the File menu, choose New File or Project...
-
In the Projects dialog, choose Other Project,
then Empty Qt Project, and then click Choose...
-
In the Location page of the Empty Qt Project dialog,
name the project QtHmi, then click Next.
Note:
All files related to the project—C++ and QML source code, resource files, and the project configuration
file—will be stored in the folder specified on the Create in line in this dialog.
-
In the Kits page, choose the kit that you configured when setting up Qt Creator
(e.g., QNX SDP 6.6 – OMAP5432), then click Next.
-
In the Summary page, click Finish to save your new project's settings.
Qt Creator creates the new project and displays the empty QtHmi.pro file in the
editing area.
-
Add the following lines to this file:
# We're building an app
TEMPLATE = app
# This is the name to give the compiled application
TARGET = QtHmi
This action configures the project to build an application binary (as opposed to a dynamic or static library).
Note:
The project file can define many variables that affect how
qmake builds the project;
for the full list, see the
Variables | QMake reference in Digia's online Qt documentation.