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 {
          // ...
        }
        // ...
    ]
}

遷移も参照


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