このページでは

StateGroup QML Type

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

Import Statement: import QtQuick

プロパティ

詳細な説明

Item(およびそのすべての派生型)は、state 、states 、transitions というプロパティを通じて、状態と遷移に対する組み込みのサポートを提供します。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.