C

Qt Quick Ultralite Automotive Cluster Demo

Demonstrates integrating QML and C++, and also using 3rd party libraries.

Overview

This is a complex application that demonstrates many aspects of applications built with Qt Quick Ultralite:

  • Integrating C++ business logic with QML applications
  • Handling complex user interfaces by splitting into multiple QML components
  • Using complex animations for best user experience without sacrificing performance

The central portion of the screen can switch between four different pages:

  • Media Player
  • Phone
  • Turn-by-turn navigation
  • Configuration

The pages and menus can be controlled by key input, using a keyboard on a desktop computer. They can also be controlled using the physical HMI knob and 4-way directional switch on the Renesas Mango main board:

ActionDesktopRH850-D1M1A
Navigate upUp keySwitch up
Navigate downDown keySwitch down
Navigate leftLeft keySwitch left
Navigate rightRight keySwitch right
Navigate nextSpace keySwitch center press
Next pagePage Up keyKnob right
Previous pagePage Down keyKnob left
ValidateEnter keyKnob press

Controlling the demo using the simulation controller

The demo can also be controlled using the C linkage API from automotive/src/simulationcontroller.h.

Each key has a corresponding API function with the qul_application_control_ prefix. Call the function with pressed as true and then with pressed as false to trigger a key press for the application.

To disable automatic page, menu and mode changes, call qul_application_force_interactive_mode with force_interactive_mode as true.

To disable simulated drive data, call qul_application_show_simulated_drive_data once with simulated_drive_data as false. After this, call the setter function, for example qul_application_set_speed to set the speed value.

To disable lane assistant animation, call qul_application_set_lane_assistant_enabled with enabled as false.

To disable simulated light indicators, call qul_application_show_simulated_light_indicators once with simulated_light_indicators as false. After this, call the setter function, for example, qul_application_set_left_blinker_on with left_blinker_on as true to set the left blinker on.

File variants

The automotive demo uses file variants and selectors to customize the application to different demo regions.

If no selectors are applied, the demo region will be set to Germany, using metric units and German street names and signage. It is possible to build the demo with file variants displaying imperial units and/or US localized street names and speed limit signage. Apply the "imperial" file selector for imperial units, and the "usa" selector for US localized street names and signage.

qmlprojectexporter demos/automotive/qmlproject/automotive.qmlproject --outdir=<output_dir> --selector=imperial,usa

When building the demo using CMake, set the DEMO_REGION variable to "usa" also adds the "imperial" selector to simplify building the application for a US audience:

cmake -DDEMO_REGION="usa" <additional args>

Target platforms

  • MCIMX93
  • RH850-D1M1A
  • STM32F769i
  • Infineon TRAVEO™ T2G

Screenshots

Normal mode

Sport mode

Benchmark mode

In the Benchmark mode, the application runs for a predefined time of 30 seconds and the performance metrics are displayed on the screen at the end of 30-seconds interval. If the Qt Quick Ultralite Core library is built with QUL_ENABLE_PERFORMANCE_CONSOLE_OUTPUT=ON, the same results are also displayed on the serial console.

The following performance metrics are displayed at the end of the test:

ParameterDescription
1Total framesTotal number of frames in the recording interval.
2Average FPSAverage frames per second value measured during the recording interval.
3Minimum FPSMinimum frames per second value captured during the recording.
4Maximum heap usageMaximum heap usage in bytes recorded since the application was started.
5Maximum stack usageMaximum stack usage in bytes recorded since the application was started.
6Average CPU loadCPU Load in percentage value averaged over the recording interval.

The Bechmark mode is provided as an independent CMake target with the name automotive_benchmark. To run the Benchmark mode, build and flash the target automotive_benchmark.

The automotive_benchmark target requires adding the compile definition, QUL_DEMO_BENCHMARK_MODE.

target_compile_definitions(automotive_benchmark PRIVATE
    QUL_DEMO_BENCHMARK_MODE
)

The automotive.qmlproject file includes the benchmark_module.qmlproject file as shown below:

ModuleFiles {
  files: [
  "benchmark/benchmark_module.qmlproject"
  ]
}

Import the following modules in the root QML file.

import QtQuickUltralite.Extras 2.0
import Benchmark 1.0
import QtQuickUltralite.Profiling
  • Qt Quick Ultralite Extras module provides QulPerf object which allows starting and stopping the measurements.
  • Benchmark module is provided by benchmark_module.qmlproject file. It provides methods for simulating touch gesture for flick control.
  • Qt Quick Ultralite Profiling module provides the screen overlay QulPerfOverlay for displaying performance metrics on top of the application user interface.

Add the QulPerfOverlay QML object for benchmark results in root qml. This overlay becomes visible when benchmarkTimer is triggered after 30 seconds.

QulPerfOverlay {
    id: benchmarkResult
    anchors.horizontalCenter: parent.horizontalCenter;
    anchors.verticalCenter: parent.verticalCenter;
    visible: false
}

Start the recording in the root QML item when the root object is instantiated and Component.onCompleted signal is triggered.

Component.onCompleted: {
    QulPerf.recording = true
}

The application runs for 30 seconds. The recording is stopped after 30 seconds and benchmark results screen overlay is made visible.

Timer {
    id: benchmarkTimer
    interval: 30000
    running: true
    repeat: false
    onTriggered: {
        QulPerf.recording = false;
        benchmarkResult.visible = true
    }
}

Note: The Benchmark mode requires Qt Quick Ultralite Core and Platform libraries to be built with QUL_ENABLE_PERFORMANCE_LOGGING=ON and QUL_ENABLE_HARDWARE_PERFORMANCE_LOGGING=ON.

Files:

Images:

Available under certain Qt licenses.
Find out more.