Wrong behavior with State's extend property
-
Hi everyone,
I was playing around with States in QML when I found out a strange behavior.
Considering this case
@State
{
name: "mainState"
when: firstBool}
State
{
name: "subStateOfMain"
when: secondBool
extend: "mainState"
}@In my sense we are in :
mainState when and only when :
@firstBool && !secondBool@subStateOfMain when and only when :
@firstBool && secondBool@What really happens with Qt is that it does a OR instead of a AND for the extender State ( "subStateOfMain" here ). Does anyone else has the same issue or feel that what I described should be the actual behavior ?
-
Hi,
It's not going like you described. Of course states are acting as OR.
From documentation :"When a state extends another state, it inherits all the changes of that state."
example can be find here: http://jingfenghanmax.blogspot.fi/2010/08/extend-property-of-qml-state.html
-
Thanks for you answer but for me it doesn't make sense to, in my case, have one state with firstBool && !secondBool while the other has firstBool && secondBool . At least we should have the possibility to choose between OR/AND .
-
I can't see states you described "have one state with firstBool && !secondBool while the other has firstBool && secondBool . "
you have one state when: firstBool and when: secondBool :)
-
well then if you have firstBool && secondBool you don't know which state you are in. It would be the first that you have in your array.