[Qt-qml] State transition proposal: PropertyChangesLater

michael.brasser at nokia.com michael.brasser at nokia.com
Tue Feb 15 03:46:11 CET 2011


On 10/02/2011, at 6:33 PM, ext Thomas Perl wrote:
> 2011/2/7 Andre Somers <andre at familiesomers.nl>:
>> What I do is something like this:
>> 
>> //in definition of inner:
>> opacity: state == "onscreen" || onscreenTransition.running ? 1 : 0
>> 
>> //your transition:
>> transitions: [
>>   Transition {
>>        AnchorAnimation {id:onscreenTransition}
>>   }
>> ]
>> 
>> I think that achieves what you want in a simpler way, and without having to
>> introduce something like PropertyChangesLater.
> 
> Thanks, I tried that. Unfortunately, it seems as if the "running"
> property of the AnchorAnimation object isn't changed when used in a
> state transition. The way I test this is by implementing a
> "onRunningChanged" slot on the object and using console.log() - I
> don't get any output, and the trick you suggested with the opacity
> doesn't work for that reason (otherwise it would be great and really
> compact).
> 
> Is that a bug in QML (should an Animation inside a Transition have its
> "running" property set to true while it's running due to a state
> change?) or is this on purpose.

This issue is covered in http://bugreports.qt.nokia.com/browse/QTBUG-13927.

> If so, is there any other way to
> achieve this "special case while in transition" mode?


Bea's suggestion (using separate Transitions with explicit 'from' and 'to') should be able to solve it for you. Alternatively, a single Transition with 'from'/'to' specified and 'reversible' set should also work. In both cases, you'd use a PropertyAction to show where in the Transition you want the opacity change to occur.

Regards,
Michael


More information about the Qt-qml mailing list