[Qt-qml] "Can't apply a state change as part of a state definition"

Adriano Rezende adriano.rezende at openbossa.org
Wed Jan 26 22:48:03 CET 2011


On Wed, Jan 26, 2011 at 5:57 PM,  <mathias.malmqvist at nokia.com> wrote:
> One of my state definitions triggers this error
> <Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition.
> and I can't quite work out why.
>
> Is it the case that no part of the state definition (like a PropertyChange) may have *any*
> effect (direct or indirect) on a property that is part of a "when" expression determining
> what the current state is?

This happens when you try to set a state in an element that is already
changing its state.

For example:

MouseArea {
    id: area
    width: 100
    height: 100

    states: State {
        when: area.pressed
        PropertyChanges { target: area; state: ""; }
    }
}

Probably in your case a state triggered other states and while these
states are being changed another state in the chain is trying to
change one of them.

Br,
Adriano


More information about the Qt-qml mailing list