[Qt-qml] Weird QALM + Repeater + Column behavior

bea.lam at nokia.com bea.lam at nokia.com
Tue Feb 1 05:52:48 CET 2011


Hi Juha,

On 30/01/2011, at 11:34 AM, ext Juha Turunen wrote:
> 
> What I want to achieve: whenever a new item is added to the model (as
> the first item) the old ones
> would slide down to make room for the new one and the new one is
> animated in. I imagined something
> like:
> 
> Column {
>  ...
>    add: Transition {
>        SequentialAnimation {
>            PauseAnimation { duration: 300 }
>            NumberAnimation { duration: 300; property: "x"; from: -360; to: 0 }
>        }
>    }
> 
>    move: Transition {
>        NumberAnimation { duration: 300; property: "y"; }
>    }
> }
> 
> No go. If I have just the add transition there's no animation at all -
> the new item simply appears at the top. I tried putting console.logs
> at the beginning and end of the animation and I get: "begin" "begin"
> "end" when a new item is added. Why is it started two times?

The move transition certainly shouldn't be necessary. It looks like a bug where adding items to a Repeater does not trigger the add transition inside its parent Column. Could you file a bug for this at bugreports.qt.nokia.com?


> 
> If I add the move transition I get at least some animation, but it's
> weird. The existing delegate instances are moved down like they
> should, but also the added item is animating from the bottom of the
> column to the top.

That sounds odd. I can't reproduce this, but if you could file a bug report with a small example then it can be checked against the current code.


> 
> Is this a bug or am I doing something wrong? Any ideas how to
> implement this? I guess I could start manually creating/destroying
> items and manage their anchors, but I'm hoping there's a more elegant
> way (although that would give me complete control of animating the
> items (docs say only x and y properties can be animated)).

If you want to animate other properties, you may be interested in using ListView instead of Column. You can specify a transition by specifying a ListView.onAdd signal handler inside the ListView delegate. This is demonstrated by the example in examples/declarative/modelviews/listview/dynamiclist.qml (also at http://doc.qt.nokia.com/4.7-snapshot/declarative-modelviews-listview-dynamiclist-qml.html).


regards,

Bea


More information about the Qt-qml mailing list