このページでは

StateGroup QML Type

Item型以外の組み込み状態のサポートを提供します。詳細...

Import Statement: import QtQuick

プロパティ

詳細説明

Item(およびすべての派生型)は、statestatestransitions プロパティを通じて、ステートと遷移をビルトインでサポートしている。StateGroupは、他の(Itemから派生していない)型でこのサポートを使用する簡単な方法を提供します。

MyCustomObject {
    StateGroup {
        id: myStateGroup
        states: State {
            name: "state1"
            // ...
        }
        transitions: Transition {
            // ...
        }
    }

    onSomethingHappened: myStateGroup.state = "state1";
}

Qt Quick ステートトランジション、および Qt Qml.

プロパティのドキュメント

state : string

このプロパティは、状態グループの現在の状態の名前を保持する。

このプロパティは、状態間を変更するスクリプトでよく使用される。例えば

function toggle() {
    if (button.state == 'On')
        button.state = 'Off';
    else
        button.state = 'On';
}

状態グループが基本状態にある(つまり、明示的な状態が設定されていない)場合、state は空白の文字列になる。同様に、現在の状態を'' に設定することで、状態グループを基本状態に戻すことができます。

Qt Quick 状態も参照のこと

states : list<State> [read-only]

このプロパティは、状態グループによって定義された状態のリストを保持する。

StateGroup {
    states: [
        State {
            // State definition...
        },
        State {
            // ...
        }
        // Other states...
    ]
}

Qt Quick ステートも参照

transitions : list<Transition> [read-only]

このプロパティは、状態グループが定義する遷移のリストを保持する。

StateGroup {
    transitions: [
        Transition {
          // ...
        },
        Transition {
          // ...
        }
        // ...
    ]
}

トランジション」も参照

© 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.