C
Qt Quick ウルトラライトサーモスタットのデモ
Qt Quick Ultraliteを使って作られた純粋なQMLベースのアプリケーションのデモ。
概要
この例では、開発者が生産準備の整ったアプリケーションに取り組む際に直面する可能性のある複数の側面を紹介します:
- 1つのアプリケーションで異なるディスプレイ解像度を扱う
- 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モジュールはQulPerf オブジェクトを提供し、計測の開始と停止を可能にします。
Benchmarkモジュールはbenchmark_module.qmlprojectファイルから提供されます。フリック操作のためのタッチジェスチャーをシミュレートするメソッドを提供します。- Qt Quick Ultralite Profilingモジュールは、アプリケーション・ユーザー・インターフェースの上にパフォーマ ンス・メトリクスを表示するためのスクリーン・オーバーレイQulPerfOverlay を提供します。
ルートqmlにベンチマーク結果用のQulPerfOverlay QMLオブジェクトを追加します。このオーバーレイは、benchmarkTimer が 30 秒後にトリガーされると表示されるようになります。
QulPerfOverlay {
id: benchmarkResult
anchors.horizontalCenter: parent.horizontalCenter;
anchors.verticalCenter: parent.verticalCenter;
visible: false
}ルートオブジェクトがインスタンス化され、Component.onCompleted シグナルがトリガーされると、ルート QML ファイルrootqml/+benchmark/thermo.qml で録画を開始します。
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.qmlproject
CMakeでビルドする場合、セレクタはすでに考慮されており、上記のように通常のターゲットとベンチマークのターゲットが作成されます。
ターゲットプラットフォーム
スクリーンショット
小画面用サーモスタット・デモ



大画面用サーモスタット・デモ



ファイル
- 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 ライセンスの下で利用可能です。
詳細はこちら。