このページでは

Qt State Machine

ステート・マシン・フレームワークは、ステート・グラフの作成と実行のためのクラスを提供します。

モジュールの使い方

QML API

モジュールのQML型は、QtQml.StateMachine のインポートから利用することができます。この型を使用するには、.qml ファイルに以下の import 文を追加してください:

import QtQml.StateMachine

C++ API

Qt モジュールの C++ API を使用するには、モジュールライブラリを直接リンクするか、他の依存関係を通 してリンクする必要があります。CMakeや qmakeなど、いくつかのビルドツールはこのための専用サポートを持っています。

CMake でのビルド

find_package() コマンドを使って、Qt6 パッケージの中から必要なモジュール・コンポーネントを探します:

find_package(Qt6 REQUIRED COMPONENTS StateMachine)
target_link_libraries(mytarget PRIVATE Qt6::StateMachine)

詳細については、CMakeによるビルドの概要を参照してください。

qmakeでのビルド

qmakeでビルドするようにモジュールを設定するには、プロジェクトの.proファイルにQT 変数の値としてモジュールを追加します:

QT += statemachine

記事とガイド

リファレンス

モジュールの進化

Qt State Machine の変更点には、Qt 6 シリーズで行われたモジュール API と機能の重要な変更点が記載されています。

ライセンス

Qt State Machine モジュールはThe Qt Company の商用ライセンスで利用できます。さらに、フリーソフトウェアライセンスでも利用可能です:GNU Lesser General Public License, version 3, またはGNU General Public License, version 2.詳細はQt ライセンスを参照してください。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.