StateGroup QML 類型

為非項類型提供內置狀態支持 更多...

import 語句: import QtQuick 2.7

特性

詳細描述

Item (and all derived types) provides built in support for states and transitions via its state , states and transitions 特性。 StateGroup provides an easy way to use this support in other (non-Item-derived) types.

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

另請參閱 Qt Quick 狀態 , 過渡 ,和 Qt QML .

特性文檔編製

state : string

This property holds the name of the current state of the state group.

This property is often used in scripts to change between states. For example:

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

If the state group is in its base state (i.e. no explicit state has been set), state will be a blank string. Likewise, you can return a state group to its base state by setting its current state to '' .

另請參閱 Qt Quick 狀態 .

狀態 : list < State >

This property holds a list of states defined by the state group.

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

另請參閱 Qt Quick 狀態 .

過渡 : list < Transition >

This property holds a list of transitions defined by the state group.

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

另請參閱 過渡 .