C
Qt Quick Ultraliteサーモスタットのデモ
Qt Quick Ultralite を使用して構築された、純粋な QML ベースのアプリケーションを実演します。
概要
このサンプルでは、本番環境向けのアプリケーション開発において開発者が直面する可能性のある、以下の複数の側面を紹介します:
- 単一のアプリケーション内での、ターゲットとなるさまざまなディスプレイ解像度の処理
- Qt Quick Ultraliteで構築されたアプリケーションの翻訳(英語、ドイツ語、日本語、アラビア語、タイ語、ヒンディー語)
- 異なる単位(メートル法とインペリアル法)を使用したアプリケーションのローカライズ
ベンチマークモード
ベンチマークモードでは、アプリケーションはあらかじめ定義された30秒間実行され、30秒間のインターバル終了時にパフォーマンス指標が画面に表示されます。Qt Quick Ultralite CoreライブラリがQUL_ENABLE_PERFORMANCE_CONSOLE_OUTPUT=ON でビルドされている場合、同じ結果がシリアルコンソールにも表示されます。
テスト終了時には、以下のパフォーマンス指標が表示されます:
| パラメータ | 説明 | |
|---|---|---|
| 1 | 総フレーム数 | 記録期間中のフレーム総数。 |
| 2 | 平均FPS | 録画期間中に測定された1秒あたりの平均フレーム数。 |
| 3 | 最小FPS | 録画中に記録された1秒あたりのフレーム数の最小値。 |
| 4 | 最大ヒープ使用量 | アプリケーションの起動以降に記録された、最大ヒープ使用量(バイト単位)。 |
| 5 | スタック使用量の最大値 | アプリケーションの起動以降に記録されたスタックの最大使用量(バイト単位)。 |
| 6 | 平均CPU負荷 | 記録間隔におけるCPU負荷の平均値(パーセンテージ)。 |
ベンチマークモードは、thermo_small_benchmark およびthermo_big_benchmark という名前の独立したCMakeターゲットとして提供されています。ベンチマークモードを実行するには、ベンチマークモードのターゲットバイナリをビルドしてフラッシュしてください。
メインの qmlproject ファイルには、以下に示すように benchmark_module.qmlproject ファイルがインクルードされています。
ModuleFiles {
files: [
"mode/benchmark_module.qmlproject"
]
}ルート QML ファイルで以下のモジュールをインポートします。
import QtQuickUltralite.Extras 2.0
import Benchmark 1.0
import QtQuickUltralite.Profiling- Qt Quick Ultralite Extras moduleは、測定の開始と停止を可能にするQulPerf オブジェクトを提供します。
Benchmarkこのモジュールは、benchmark_module.qmlprojectファイルによって提供されます。フリック操作のためのタッチジェスチャーをシミュレートするメソッドを提供します。- Qt Quick Ultralite Profiling このモジュールは、アプリケーションのユーザーインターフェース上にパフォーマンス指標を表示するための画面オーバーレイ `QulPerfOverlay ` を提供します。
ルート QML ファイルに、ベンチマーク結果用の `QulPerfOverlay ` QML オブジェクトを追加してください。このオーバーレイは、30 秒後に `benchmarkTimer ` がトリガーされると表示されます。
QulPerfOverlay {
id: benchmarkResult
anchors.horizontalCenter: parent.horizontalCenter;
anchors.verticalCenter: parent.verticalCenter;
visible: false
}ルート QML ファイル `rootqml/+benchmark/thermo.qml` 内で、ルートオブジェクトがインスタンス化され、Component.onCompleted シグナルがトリガーされた時点で、記録を開始します。
Component.onCompleted: {
QulPerf.recording = true
}アプリケーションは30秒間実行されます。30秒後に記録が停止し、ベンチマーク結果画面のオーバーレイが表示されます。
Timer {
id: benchmarkTimer
interval: 30000
running: true
repeat: false
onTriggered: {
QulPerf.recording = false;
benchmarkResult.visible = true
}
}注:ベンチマークモードを使用するには 、Qt Quick のUltralite CoreおよびPlatformライブラリを、QUL_ENABLE_PERFORMANCE_LOGGING=ON およびQUL_ENABLE_HARDWARE_PERFORMANCE_LOGGING=ON でビルドする必要があります。
ファイルのバリエーション
サーモスタットのデモには、小型UI用およびベンチマークモード用のファイルバリアントとセレクタが含まれています。ベンチマークモード用のソースをエクスポートするには、「"benchmark" 」ファイルセレクタを適用してください。小型UIバリアント用のソースをエクスポートするには、「"small" 」ファイルセレクタを使用してください。
qmlprojectexporter --selector benchmark,small demos/thermo/qmlproject/thermo.qmlprojectCMake を使用してビルドする場合、これらのセレクタはすでに考慮されており、前述のように通常モードとベンチマークモードのターゲットが生成されます。
ターゲットプラットフォーム
スクリーンショット
小画面向けサーモスタットデモ



大画面向けサーモスタットデモ



ファイル:
- thermo/+ra8d1/StatsContents.qml
- thermo/+ra8d1/Theme.qml
- thermo/+small/Theme.qml
- thermo/AnimatedDigit.qml
- thermo/BottomBar.qml
- thermo/CMakeLists.txt
- thermo/Card.qml
- thermo/CardRow.qml
- thermo/ErrorScreen.qml
- thermo/FanControlButton.qml
- thermo/LanguageButton.qml
- thermo/LanguageDialog.qml
- thermo/PlacesView.qml
- thermo/PowerSwitch.qml
- thermo/RoomControlButton.qml
- thermo/RoomSchedule.qml
- thermo/RoomView.qml
- thermo/ScheduleView.qml
- thermo/StatsContents.qml
- thermo/StatsView.qml
- thermo/Theme.qml
- thermo/ThermoView.qml
- thermo/TimeIntervalSlider.qml
- thermo/TimeIntervalSliderHandle.qml
- thermo/TopBar.qml
- thermo/WeatherStatus.qml
- thermo/dynamic/Configuration.qml
- thermo/fonts/Spark/FontConfiguration.qml
- thermo/fonts/Static/FontConfiguration.qml
- thermo/imperial/Units.qml
- thermo/imports/Thermo/ColorStyle.qml
- thermo/imports/Thermo/GlobalState.qml
- thermo/imports/Thermo/Room.qml
- thermo/imports/Thermo/Rooms.qml
- thermo/imports/Thermo/qmldir
- thermo/imports/ThermoConfiguration/qmldir
- thermo/metric/Units.qml
- thermo/mode/+benchmark/benchmark_module.qmlproject
- thermo/mode/+benchmark/simulation/flickControl.cpp
- thermo/mode/+benchmark/simulation/flickControl.h
- thermo/mode/benchmark_module.qmlproject
- thermo/qmlproject/thermo.qmlproject
- thermo/qmlproject/thermo_configuration_module.qmlproject
- thermo/qmlproject/thermo_mimxrt1064.qmlproject
- thermo/qmlproject/thermo_module.qmlproject
- thermo/qmlproject/thermo_ra8d1.qmlproject
- thermo/qmlproject/thermo_stm32.qmlproject
- thermo/rootqml/+benchmark/thermo.qml
- thermo/rootqml/thermo.qml
- thermo/src/os/baremetal/main.cpp
- thermo/static/Configuration.qml
- thermo/thermo.ar_EG.ts
- thermo/thermo.de_DE.ts
- thermo/thermo.en_GB.ts
- thermo/thermo.hi_IN.ts
- thermo/thermo.ja_JP.ts
- thermo/thermo.th_TH.ts
画像:
- thermo/SparkFE/+small/popup-bg.png
- thermo/SparkFE/popup-bg.png
- thermo/StaticFE/+small/popup-bg.png
- thermo/StaticFE/popup-bg.png
- thermo/images/+ra8d1/stats-month.png
- thermo/images/+ra8d1/stats-year.png
- thermo/images/+ra8d1/top-bar-shadow.png
- thermo/images/+small/EGYPT.png
- thermo/images/+small/GERMANY.png
- thermo/images/+small/INDIA.png
- thermo/images/+small/JAPAN.png
- thermo/images/+small/Static/popup-bg.png
- thermo/images/+small/THAILAND.png
- thermo/images/+small/UK.png
- thermo/images/+small/auto-card.png
- thermo/images/+small/auto-on.png
- thermo/images/+small/baseline-arrow-back.png
- thermo/images/+small/btn-bg-big-off.png
- thermo/images/+small/btn-bg-big-on.png
- thermo/images/+small/btn-bg-down.png
- thermo/images/+small/change-language.png
- thermo/images/+small/close.png
- thermo/images/+small/digitMaskBottom.png
- thermo/images/+small/digitMaskTop.png
- thermo/images/+small/dryer-on-small.png
- thermo/images/+small/dryer-on.png
- thermo/images/+small/eco-on-small.png
- thermo/images/+small/eco-on.png
- thermo/images/+small/fan-1-on-small.png
- thermo/images/+small/fan-1-on.png
- thermo/images/+small/fan-2-on-small.png
- thermo/images/+small/fan-2-on.png
- thermo/images/+small/fan-3-on-small.png
- thermo/images/+small/fan-3-on.png
- thermo/images/+small/fan-4-on-small.png
- thermo/images/+small/fan-4-on.png
- thermo/images/+small/fan-off-small.png
- thermo/images/+small/fan-off.png
- thermo/images/+small/jog-off.png
- thermo/images/+small/jog.png
- thermo/images/+small/page-indicator.png
- thermo/images/+small/place-back.png
- thermo/images/+small/popup-bg.png
- thermo/images/+small/power-on.png
- thermo/images/+small/pressed-bg-down.png
- thermo/images/+small/pressed-bg-up.png
- thermo/images/+small/qt-logo.png
- thermo/images/+small/radiobutton-checked-pressed.png
- thermo/images/+small/radiobutton-checked.png
- thermo/images/+small/radiobutton-pressed.png
- thermo/images/+small/radiobutton.png
- thermo/images/+small/scrollbar-off-track.png
- thermo/images/+small/scrollbar-temperature-track.png
- thermo/images/+small/selected.png
- thermo/images/+small/separator-line.png
- thermo/images/+small/slider-handle.png
- thermo/images/+small/stats-month.png
- thermo/images/+small/stats-year.png
- thermo/images/+small/status-small.png
- thermo/images/+small/streamer-on-small.png
- thermo/images/+small/streamer-on.png
- thermo/images/+small/switch-bg.png
- thermo/images/+small/switch-handle.png
- thermo/images/+small/switch-i.png
- thermo/images/+small/switch-o.png
- thermo/images/+small/temp-down-pressed.png
- thermo/images/+small/temp-up-pressed.png
- thermo/images/+small/thermo-handle.png
- thermo/images/+small/toggle-month.png
- thermo/images/+small/toggle-year.png
- thermo/images/+small/top-bar-shadow.png
- thermo/images/EGYPT.png
- thermo/images/GERMANY.png
- thermo/images/INDIA.png
- thermo/images/JAPAN.png
- thermo/images/Static/popup-bg.png
- thermo/images/THAILAND.png
- thermo/images/UK.png
- thermo/images/auto-card.png
- thermo/images/auto-on.png
- thermo/images/baseline-arrow-back.png
- thermo/images/btn-bg-big-off.png
- thermo/images/btn-bg-big-on.png
- thermo/images/btn-bg-down.png
- thermo/images/card-back-bottomleft.png
- thermo/images/card-back-bottomright.png
- thermo/images/card-back-topleft.png
- thermo/images/card-back-topright.png
- thermo/images/change-language.png
- thermo/images/close.png
- thermo/images/digitMaskBottom.png
- thermo/images/digitMaskTop.png
- thermo/images/dryer-on-small.png
- thermo/images/dryer-on.png
- thermo/images/eco-on-small.png
- thermo/images/eco-on.png
- thermo/images/error-text.png
- thermo/images/fan-1-on-small.png
- thermo/images/fan-1-on.png
- thermo/images/fan-2-on-small.png
- thermo/images/fan-2-on.png
- thermo/images/fan-3-on-small.png
- thermo/images/fan-3-on.png
- thermo/images/fan-4-on-small.png
- thermo/images/fan-4-on.png
- thermo/images/fan-off-small.png
- thermo/images/fan-off.png
- thermo/images/inner-circle.png
- thermo/images/jog-off.png
- thermo/images/jog.png
- thermo/images/page-indicator.png
- thermo/images/place-back.png
- thermo/images/power-on.png
- thermo/images/pressed-bg-down.png
- thermo/images/pressed-bg-up.png
- thermo/images/qt-logo.png
- thermo/images/radiobutton-checked-pressed.png
- thermo/images/radiobutton-checked.png
- thermo/images/radiobutton-disabled.png
- thermo/images/radiobutton-pressed.png
- thermo/images/radiobutton.png
- thermo/images/scrollbar-off-track.png
- thermo/images/scrollbar-temperature-track.png
- thermo/images/selected.png
- thermo/images/separator-line.png
- thermo/images/slider-handle.png
- thermo/images/stats-month.png
- thermo/images/stats-year.png
- thermo/images/status-small.png
- thermo/images/streamer-on-small.png
- thermo/images/streamer-on.png
- thermo/images/switch-bg.png
- thermo/images/switch-handle.png
- thermo/images/switch-i.png
- thermo/images/switch-o.png
- thermo/images/temp-down-pressed.png
- thermo/images/temp-up-pressed.png
- thermo/images/thermo-handle.png
- thermo/images/toggle-month.png
- thermo/images/toggle-year.png
- thermo/images/top-bar-shadow.png
- thermo/images/weather/+small/w_01.png
- thermo/images/weather/+small/w_02.png
- thermo/images/weather/+small/w_03.png
- thermo/images/weather/+small/w_04.png
- thermo/images/weather/+small/w_05.png
- thermo/images/weather/+small/w_06.png
- thermo/images/weather/+small/w_07.png
- thermo/images/weather/w_01.png
- thermo/images/weather/w_02.png
- thermo/images/weather/w_03.png
- thermo/images/weather/w_04.png
- thermo/images/weather/w_05.png
- thermo/images/weather/w_06.png
- thermo/images/weather/w_07.png
特定のQtライセンスの下で利用可能です。
詳細はこちらをご覧ください。