C
Qt Quick ウルトラライト自動車用クラスターのデモ
QMLとC++を統合し、サードパーティのライブラリを使用するデモ。
概要
これは、Qt Quick Ultraliteで構築されたアプリケーションの多くの側面を示す複雑なアプリケーションです:
- C++ビジネスロジックとQMLアプリケーションの統合
- 複数のQMLコンポーネントに分割することによる複雑なユーザーインターフェースの処理
- パフォーマンスを犠牲にすることなく、複雑なアニメーションを使用して最高のユーザーエクスペリエンスを実現する
画面中央部では、4つの異なるページを切り替えることができます:
- メディアプレーヤー
- 電話
- ターンバイターンナビゲーション
- 設定
ページとメニューは、デスクトップコンピュータのキーボードを使ったキー入力で制御できます。また、Renesas Mangoメインボード上の物理的なHMIノブと4方向スイッチを使用して制御することもできます:
| アクション | デスクトップ | RH850-D1M1A |
|---|---|---|
| 上へ移動 | アップキー | 上に移動 |
| 下に移動 | ダウンキー | 下に移動 |
| 左へ移動 | 左キー | 左へ移動 |
| 右へ移動 | 右キー | 右へ移動 |
| 次へ移動 | スペースキー | 中央を押す |
| 次のページに移動 | ページアップキー | ノブ右 |
| 前のページ | ページダウンキー | ノブ左 |
| 有効 | エンターキー | ノブプレス |
シミュレーションコントローラーを使ったデモのコントロール
デモは、automotive/src/simulationcontroller.h からの C linkage API を使用して制御することもできます。
各キーには、qul_application_control_ 接頭辞を持つ対応する API 関数があります。pressed をtrue として関数を呼び出し、pressed をfalse として関数を呼び出すと、アプリケーションのキー押下がトリガーされます。
自動ページ切り替え、メニュー切り替え、モード切り替えを無効にするには、force_interactive_mode をtrue としてqul_application_force_interactive_mode を呼び出します。
シミュレートされたドライブ・データを無効にするには、simulated_drive_data をfalse として、qul_application_show_simulated_drive_data を一度呼び出します。この後、例えば速度値を設定するにはqul_application_set_speed のように、セッター機能を呼び出します。
レーンアシスタントアニメーションを無効にするには、enabled をfalse としてqul_application_set_lane_assistant_enabled を呼び出します。
ライト・インジケータのシミュレーションを無効にするには、simulated_light_indicators をfalse としてqul_application_show_simulated_light_indicators を 1 回呼び出します。この後、セッター関数、例えばleft_blinker_on をtrue としてqul_application_set_left_blinker_on を呼び出し、左ウィンカーをオンに設定します。
ファイルのバリエーション
オートモーティブ・デモでは、ファイル・バリアントとセレクタを使用して、アプリケーションをさまざまなデモ地域にカスタマイズします。
セレクタが適用されていない場合、デモ地域はドイツに設定され、メートル単位とドイツの道路名と標識が使用されます。インペリアル単位および/または米国ローカライズされた道路名と速度制限標識を表示するファイルバリアントでデモを構築することも可能です。インペリアル単位には"imperial" ファイルセレクタを、米国ローカライズされた道路名と標識には"usa" セレクタを適用してください。
qmlprojectexporter demos/automotive/qmlproject/automotive.qmlproject --outdir=<output_dir> --selector=imperial,usa
CMakeを使用してデモをビルドする場合、DEMO_REGION 変数を"usa" に設定すると、"imperial" セレクタも追加され、米国向けのアプリケーションのビルドが簡単になります:
cmake -DDEMO_REGION="usa" <additional args>
対象プラットフォーム
スクリーンショット
ノーマルモード

スポーツモード

ベンチマークモード
ベンチマーク・モードでは、アプリケーションはあらかじめ定義された 30 秒間実行され、30 秒のインターバルが終わると画面上にパ フォーマンス・メトリクスが表示されます。Qt Quick Ultralite Core ライブラリがQUL_ENABLE_PERFORMANCE_CONSOLE_OUTPUT=ON でビルドされている場合、同じ結果がシリアルコンソールにも表示されます。
テスト終了時に表示されるパフォーマンス指標は以下のとおりです:
| パラメータ | パラメータ | |
|---|---|---|
| 1 | 合計フレーム数 | 記録間隔の総フレーム数。 |
| 2 | 平均FPS | 記録インターバル中に測定された1秒あたりの平均フレーム数。 |
| 3 | 最小FPS | 録画中にキャプチャされた1秒あたりの最小フレーム数。 |
| 4 | 最大ヒープ使用量 | アプリケーションが起動してから記録された最大ヒープ使用量(バイト)。 |
| 5 | 最大スタック使用量 | アプリケーション起動時から記録されている最大スタック使用量(バイト)。 |
| 6 | 平均CPU負荷 | 記録間隔を平均したパーセント値でのCPU負荷。 |
ベンチマークモードは、automotive_benchmark という名前の独立した CMake ターゲットとして提供されます。ベンチマークモードを実行するには、ターゲットautomotive_benchmark をビルドしてフラッシュします。
automotive_benchmark ターゲットは、コンパイル定義QUL_DEMO_BENCHMARK_MODE を追加する必要があります。
target_compile_definitions(automotive_benchmark PRIVATE
QUL_DEMO_BENCHMARK_MODE
)automotive.qmlproject ファイルには、以下に示すようにbenchmark_module.qmlproject ファイルが含まれています:
ModuleFiles {
files: [
"benchmark/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 項目で録画を開始します。
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 でビルドする必要があります。
ファイル
- automotive/+imperial/SpeedLimitImage.qml
- automotive/+imperial/SpeedLimitValues.qml
- automotive/+imperial/Units.qml
- automotive/+ra8d1/automotive.qml
- automotive/BaseGauge.qml
- automotive/CMakeLists.txt
- automotive/CarStatus.qml
- automotive/DriveModeSelector.qml
- automotive/Gauge.qml
- automotive/GuideArrow.qml
- automotive/GuideArrowItem.qml
- automotive/LaneAssist.qml
- automotive/LaneAssistWhiteLine.qml
- automotive/LinearGauge.qml
- automotive/MediaPlayer.qml
- automotive/Menu.qml
- automotive/MiddleGauge.qml
- automotive/Navi.qml
- automotive/NormalMode.qml
- automotive/NormalModeContentItem.qml
- automotive/Phone.qml
- automotive/SpeedLimitImage.qml
- automotive/SpeedLimitValues.qml
- automotive/SpeedWarningIndicator.qml
- automotive/SportGauge.qml
- automotive/SportMode.qml
- automotive/TellTales.qml
- automotive/TellTalesIndicator.qml
- automotive/TempGauge.qml
- automotive/Units.qml
- automotive/automotive.qml
- automotive/benchmark/benchmark_module.qmlproject
- automotive/benchmark/benchmarkmode.h
- automotive/imports/Automotive/MainModel.qml
- automotive/imports/Automotive/MathAPI.qml
- automotive/imports/Automotive/MediaPlayerModel.qml
- automotive/imports/Automotive/NaviModel.qml
- automotive/imports/Automotive/NormalModeModel.qml
- automotive/imports/Automotive/PhoneModel.qml
- automotive/imports/Automotive/SettingsMenuModel.qml
- automotive/imports/Automotive/SportModeModel.qml
- automotive/imports/Automotive/Style.qml
- automotive/imports/Automotive/TellTalesModel.qml
- automotive/imports/Automotive/qmldir
- automotive/qmlproject/automotive.qmlproject
- automotive/qmlproject/automotive_module.qmlproject
- automotive/qmlproject/automotive_ra8d1.qmlproject
- automotive/qmlproject/automotive_traveo_t2g.qmlproject
- automotive/region/+usa/Region.qml
- automotive/region/Region.qml
- automotive/src/connectivityservice.cpp
- automotive/src/connectivityservice.h
- automotive/src/hmi_input/CMakeLists.txt
- automotive/src/hmi_input/hmi_input.cpp
- automotive/src/hmi_input/hmi_input.h
- automotive/src/hmi_input/hmi_input_event.h
- automotive/src/hmi_input/rh850-d1m1a-baremetal/CMakeLists.txt
- automotive/src/hmi_input/rh850-d1m1a-baremetal/rh850.cpp
- automotive/src/mathutils.h
- automotive/src/platform/baremetal/main.cpp
- automotive/src/simulation/drivestates.cpp
- automotive/src/simulation/drivestates.h
- automotive/src/simulation/drivetrain.cpp
- automotive/src/simulation/drivetrain.h
- automotive/src/simulation/lights.cpp
- automotive/src/simulation/lights.h
- automotive/src/simulation/smfwd.h
- automotive/src/simulation/speedlimits.cpp
- automotive/src/simulation/speedlimits.h
- automotive/src/simulation/stateid.h
- automotive/src/simulation/states.cpp
- automotive/src/simulation/states.h
- automotive/src/simulationcontroller.cpp
- automotive/src/simulationcontroller.h
- automotive/src/statemachine.h
画像
- automotive/images/airbag.png
- automotive/images/albums/ak.png
- automotive/images/albums/juno.png
- automotive/images/albums/phazz.png
- automotive/images/albums/thievery-corp.png
- automotive/images/albums/tycho.png
- automotive/images/arrow-0.png
- automotive/images/arrow-45.png
- automotive/images/arrow-90.png
- automotive/images/arrow-round.png
- automotive/images/assets-phone-list-pseudo-mask.png
- automotive/images/battery.png
- automotive/images/bg-mask.png
- automotive/images/car-highlights.png
- automotive/images/clock.png
- automotive/images/fuel.png
- automotive/images/gauge-gauge-frame-sport-center.png
- automotive/images/gauge-gauge-frame-sport-side.png
- automotive/images/gauge-gauge-frame.png
- automotive/images/gauge-normal.png
- automotive/images/highlight-big-sport.png
- automotive/images/highlight-normal.png
- automotive/images/highlight-standard-sport.png
- automotive/images/leaf.png
- automotive/images/low-beam-headlights.png
- automotive/images/navi.png
- automotive/images/needle-normal.png
- automotive/images/needle-standard-sport.png
- automotive/images/oil-temp.png
- automotive/images/parked.png
- automotive/images/parking-lights.png
- automotive/images/phone.png
- automotive/images/photos/aryn.png
- automotive/images/photos/beatriz.png
- automotive/images/photos/caspar.png
- automotive/images/photos/hirini.png
- automotive/images/photos/joslin.png
- automotive/images/play.png
- automotive/images/pseudo-mask-vertical.png
- automotive/images/ready.png
- automotive/images/red-border-left.png
- automotive/images/red-border-right.png
- automotive/images/road.png
- automotive/images/setup.png
- automotive/images/speed-limit-warning.png
- automotive/images/speed-limit-warnings/140.png
- automotive/images/speed-limit-warnings/20mph.png
- automotive/images/speed-limit-warnings/30.png
- automotive/images/speed-limit-warnings/35mph.png
- automotive/images/speed-limit-warnings/45mph.png
- automotive/images/speed-limit-warnings/50.png
- automotive/images/speed-limit-warnings/55mph.png
- automotive/images/speed-limit-warnings/70.png
- automotive/images/speed-limit-warnings/85mph.png
- automotive/images/speed-limit-warnings/90.png
- automotive/images/sport.png
- automotive/images/top-line.png
- automotive/images/turn_left.png
- automotive/images/turn_right.png
- automotive/images/white-line-left.png
- automotive/images/white-line-right.png