C

Qt Quick Ultralite Thermostat Demo

Demonstrates a pure QML-based application built using Qt Quick Ultralite.

Overview

This example showcases multiple aspects that developers might face while working on production ready applications:

  • Handling different target display resolutions in a single application
  • Translating applications built with Qt Quick Ultralite (English, German, Japanese, Arabic, Thai and Hindi)
  • Localizing applications by using different units (metric and imperial)

Note: On EK-RA6M3G, this demo uses Static font engine, and languages with complex scripts are disabled.

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 Benchmark mode is provided as an independent CMake target with the name thermo_small_benchmark and thermo_big_benchmark. To run the Benchmark mode, build and flash the benchmark mode target binary.

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

ModuleFiles {
  files: [
  "mode/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 file, rootqml/+benchmark/thermo.qml, 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.

Target platforms

  • EK-RA6M3G
  • MIMXRT1050
  • MIMXRT1060
  • MIMXRT1064
  • STM32F469i
  • STM32F769i
  • STM32H750b

Screenshots

Thermostat Demo for small screens

Thermostat Demo for large screens

Files:

Images:

Available under certain Qt licenses.
Find out more.