The Qt Quick Ultralite toolchain is built around CMake. The build process starts with the CMake configuration phase where, the application's CMakeLists.txt and Qt Quick Ultralite package's CMake files are used to prepare the build files. The actual build process depends on the selected CMake generator.
The Qt Quick Ultralite build process is demonstrated with an example application that connects over Bluetooth to a mobile phone and fetches a contact list. The project includes the following files:
|Main.qml||Defines the main application view|
|QML files||Defines the application UI.|
|C++ sources||Defines custom data types for the visual items, such as a ListView .|
|C/C++ sources files||Defines the application logic.|
|main.cpp||Defines main(), which uses Qul::Application for starting Qt Quick Ultralite.|
|图像||Image assets used by the application.|
|字体||Font files used by the application.|
|CMakeLists.txt||A project configuration file|
The following diagram provides an overview of the example application's build process:
qmlinterfacegenerator parses C++ header files for custom QML elements. For example, this is done to provide a connection between QML and application business logic layers.
resource compiler generates optimized raw data buffers out of the source images. The
CMake command adds them to the build and
can be used to configure
The optimization process depends on the platform and the configuration. For example, optimization can result in lowering color depth, replacing the image with an alphamap, removing larger transparent areas, and swizzling.
The resource configuration is passed to qulrcc as a JSON file that CMake generates. The resource compiler informs qmltocpp about available resources by generating a separate JSON file with resource descriptions.
qmltocpp tool provides the following functionality:
fontcompiler reads the text and font description JSON files and generates C++ code for the selected font handling subsystem. For more details, see 文本渲染和字体 .
After the additional code is generated, the compilation starts. Input for a compiler is as follows:
Finally, you need to link statically against the Qt Quick Ultralite libraries. Depending on your target platform, linking provides the following outcome: