[Qt-qml] Add Remove animations in ListView
Adriano Rezende
adriano.rezende at openbossa.org
Tue Mar 30 21:09:09 CEST 2010
Hi,
This is exactly what I wanted.
I didn't know about these 2 attached signals in the ListView.
The "synchrony" problem I was talking about is when you need to handle
these animations in sequence. For example, if I call add method 3
times, it would trigger the first add animation and when the first
animation finishes the second one would start an so on. So in a given
moment listview and model would have different informations.
But looking at the code I presume you use internally a parallel
approach which is much better, since you don't need to keep track of
the model changes. Every operation in the model will reflect
immediately in the listview triggering an animation without delay.
This solution fits very well in most of my use cases. Thanks.
I have another question regarding image provider:
I usually use an image pre-loader in applications with a large set of
images to reduce loading time, showing an initial throbber while
loading the images used by the application in another thread.
I want to know if there is an official way to do this in QML.
I see that I can register a QDeclarativeImageProvider, that could have
a hash of pre-loaded images. But I presume this would consume more
memory since the image would be transformed internally in a QPixmap in
the main thread, duplicating the data, and also the image requests are
performed in another thread.
The original loader stores pixmaps discarding the original image data.
I thought to store these pixmaps in the QPixmapCache using the same
key format used internally in Qt but this is a very invasive solution.
The current implementation register the loader in QML. Ex.: Image {
pixmap: loader.pixmap("path"); }
Any suggestions?
Cheers,
Adriano
On Mon, Mar 29, 2010 at 9:54 PM, <aaron.kennedy at nokia.com> wrote:
> I've attached a modified version of the
> examples/declarative/listview/dynamic.qml example to demonstrate this. As
> Martin says, for now you will have to model move as a remove followed by an
> add.
>
> Can you explain your "synchrony" problem in more detail?
>
> Cheers,
>
> Aaron
More information about the Qt-qml
mailing list