[Qt-qml] QSortFilterProxyModel with QML ListView

Stephen Kelly steveire at gmail.com
Wed Sep 15 13:25:13 CEST 2010


Martin Jones wrote:

> On Wed, 15 Sep 2010 06:13:02 am ext Cornelius Hald wrote:
>> Hi,
>> 
>> On Tue, 2010-09-14 at 17:48 +0200, Stephen Kelly wrote:
>> > Cornelius Hald wrote:
>> > > Hi,
>> > > 
>> > > I've now managed to use my own data model together with a customized
>> > > QSortFilterProxyModel to provide sorting and searching for my QML UI.
>> > > I still have two open questions, though.
>> > > 
>> > > 1) Is there a way to animate sorting? I have animations for inserting
>> > > and removing data and they are also used when filtering (very nice).
>> > > But I would also like to give the user some feedback about changed
>> > > sorting as well.
>> > 
>> > Not in the current design of the QML model handling stuff because
>> > QPersistentModelIndexes are not used by QML.
>> 
>> that's a pity, but I think I can give some other visual indicator just
>> to give the user feedback. Currently it's sometimes difficult so see
>> that the sorting has changed because it just happens too fast.

Its worth a bug report if you make one. This stuff is new and the trolls are 
trying to figure out what is needed in the API. It's a good time for that 
kind of feedback.

>> 
>> > How do you do animate the items in and out? Undocumented internals or
>> > some other way?
>> 
>> Sorry, but I'm not exactly sure what you are asking. Are you asking how
>> I animate the inserts and removes? If yes, I'm using the attached
>> signals onAdd() and onRemove() of the ListView element. In my delegate I
>> react on those signals and make the delegates shrink/grow and fade
>> out/in.
> 
> See examples/declarative/modelviews/listview/dynamiclist.qml
> 

Ah, I didn't know that was possible. Neat.

All the best,

Steve.



More information about the Qt-qml mailing list