[Qt-qml] Applying common behaviour to a group of elements

michael.brasser at nokia.com michael.brasser at nokia.com
Thu Aug 5 02:11:33 CEST 2010


Hi,

On 05/08/2010, at 8:38 AM, ext Alex wrote:
> Is there a declarative approach for me to express the following?
> 
> 1.  animate fade-in for element A
> 2.  play sound(S) and wait for completion
> 3.  animate fade-in for element B

Typcially ScriptAction is used insert a block of script to execute mid-animation, i.e.

SequentialAnimation {
    NumberAnimation {}
    ScriptAction { script: mediaPLayer.play() }
    NumberAnimation {}
}

The multimedia elements provided by Qt mobility don't block when play() is called, so you wouldn't get the "wait for completion" behavior you described. Assuming your own elements are the same (a blocking play could cause issues with the animation -- http://bugreports.qt.nokia.com/browse/QTBUG-12662), and similar to Alan's proposal, you could do something like

SequentialAnimation {
    NumberAnimation {}
    ParallelAnimation {
        ScriptAction {}
        PauseAnimation {}
    }
    NumberAnimation {}
}

Eventually we'd like the multimedia elements to be able to be inserted in an animation directly -- maybe at that point we could give more intuitive control over blocking as well. 

Michael



More information about the Qt-qml mailing list