C

Qt Quick Ultralite Watch Demo

Demonstrates simple integration of QML and C++ in application for wearable devices.

Overview

The watch example demonstrates a wearable application built with Qt Quick Ultralite. It uses QML with some basic C++. It is intended to be used on devices with small displays with touch support. In addition, it performs basic gesture recognition which the demo uses to switch between different watch shields.

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-second 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 watch_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/watch.qml, when the root object is instantiated and the 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 becomes 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

Files:

Images:

Available under certain Qt licenses.
Find out more.