[Qt-qml] ListView and visible items

jaakko.korpela at nokia.com jaakko.korpela at nokia.com
Thu Feb 3 09:51:20 CET 2011


So this would involve going over all items in ListView and see which ones are visible?

/Jaakko

From: Lundqvist Petrus (Nokia-MS/Helsinki)
Sent: 03 February, 2011 09:58
To: Korpela Jaakko (Nokia-MS-Qt/Tampere); qt-qml at qt.nokia.com
Subject: Re: [Qt-qml] ListView and visible items

Why not just track the bounding box of an item delegate relative to the listview's bounding box?

Peppe

From: "ext jaakko.korpela at nokia.com<mailto:jaakko.korpela at nokia.com>" <jaakko.korpela at nokia.com<mailto:jaakko.korpela at nokia.com>>
Date: Thu, 3 Feb 2011 07:56:05 +0000
To: <qt-qml at qt.nokia.com<mailto:qt-qml at qt.nokia.com>>
Subject: [Qt-qml] ListView and visible items

Hi,

I am looking at ways to dig out the visible items in ListView. I have a requirement to trigger certain behavior every time a new item becomes visible while scrolling. ListView is internally aware of the items that are currently visible as ListView.indexAt returns -1 if the item at a certain coordinate is not visible. But what are the ways to find out what items are visible visible. I have tried a couple of approaches with my particular requirement.

First, make use of Component.onCompleted in ListView delegates. The only trouble with this is that the first list item in ListView is never deleted, so you cannot rely on this tell you when that first item becomes visible while scrolling.

The second approach involves using ListView.indexAt and pulling the indexes of the two items at the edges at a certain interval and see if there are any changes. This actually works, but I am not really happy with this approach.

Any suggestions?

/Jaakko

_______________________________________________ Qt-qml mailing list Qt-qml at qt.nokia.com<mailto:Qt-qml at qt.nokia.com> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110203/ba2309f4/attachment.html 


More information about the Qt-qml mailing list