[Qt-qml] Weird QALM + Repeater + Column behavior
Juha Turunen
turunen at iki.fi
Sun Jan 30 02:34:18 CET 2011
Hi all,
I've been banging my head to the wall for couple of hours now and
could use some help.
First, my setup:
- A QAbstractListModel derived model which has a method for prepending
an item to the list which
* first calls beginInsertRows(QModelIndex(), 0, 0)
* prepends an item to a QList
* calls endInsertRows
- A Repeater element that uses the aforementioned model
- A Column element which is the parent of the Repeater
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?
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.
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)).
Juha
More information about the Qt-qml
mailing list