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

2010-08-04 Thread Alex
That works great, thanks! Alex On Wed, Aug 4, 2010 at 5:14 PM, wrote: > On 05/08/2010, at 10:02 AM, ext Alex wrote: > >> C++ method: >> >> void Sequencer::addItem(QDeclarativeItem *item) >> { >>    item->setOpacity(1); >> } >> >> >> Representative QML, not verbatim: >> >>    Behavior on opacity

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

2010-08-04 Thread Alex
That's much better. I totally missed ScriptAction. I think I prefer this to your other suggestion (using onPlaybackCompleted) since it allows me to keep all the sequencing information in one place. My playback function is asynchronous, but I suppose I can add a method to retrieve the duration be

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

2010-08-04 Thread michael.brasser
On 05/08/2010, at 8:38 AM, ext Alex wrote: > As you saw, I am using SequentialAnimation to sequence animations, but > what if I want a non-animation in the sequence? > > For example, assume I've exposed a C++ "MediaPlayer" component to QML, > which has a playFile(path) slot and playbackCompleted()

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

2010-08-04 Thread michael.brasser
On 05/08/2010, at 10:02 AM, ext Alex wrote: > C++ method: > > void Sequencer::addItem(QDeclarativeItem *item) > { >item->setOpacity(1); > } > > > Representative QML, not verbatim: > >Behavior on opacity { >NumberAnimation { to: 1; duration: 1000 } >} > > This correctly cha

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

2010-08-04 Thread michael.brasser
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 execu

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

2010-08-04 Thread Alex
Makes sense. I cooked up something similar, but I don't like it at all :-) Instead, I started creating a C++ class for sequencing these things, but ran into a strange (?) issue. C++ method: void Sequencer::addItem(QDeclarativeItem *item) { item->setOpacity(1); } Representative QML, not v

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

2010-08-04 Thread alan.westbrook
Interesting problem. I haven't seen anything that is designed for this type of thing, perhaps the guys in Brisbane have an idea for that. But, I have an idea for a way to do it: * Se up Element A onOpacityChanged to start playing sound * Know (before hand) how long the audio clip is. Widget

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

2010-08-04 Thread Alex
Thanks, Alan. I have another question related to my example. As you saw, I am using SequentialAnimation to sequence animations, but what if I want a non-animation in the sequence? For example, assume I've exposed a C++ "MediaPlayer" component to QML, which has a playFile(path) slot and playbackC

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

2010-08-04 Thread alan.westbrook
I'm not sure if there is an easy declarative way to do that. You could probably write a javascript function that would take care of some of the typing, something like: Component.onCompleted: { for(var i = 0; i < target_id_list.count(); ++i) { var obj = numberAnima

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

2010-08-04 Thread Alex
Hi Alan, Sorry for not being more clear. I have a large number of pages, with each page containing several elements. The "fading in" behaviour applies to the elements on a given page. The large number of pages is my motivation for encapsulating this behaviour, so I don't have to re-implement it

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

2010-08-04 Thread alan.westbrook
So it's a slideshow and each element is a page, and you have hundreds of pages? Or do you have a few pages each with a bunch of elements? Or do you have hundreds of elements which pop in and out on a single page? Depending on what you mean, you could try putting your elements in a model and ite

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

2010-08-04 Thread Alex
Hi all, I am building an application that has a PowerPoint-like informational component. To this end, I have a bunch of QML files that display content progressively, with items fading in one at a time. In my current implementation, I give each object an id and set opacity to 0. I then have a Sequ