[Qt-qml] smooth scrolling using positionViewatIndex

bea.lam at nokia.com bea.lam at nokia.com
Wed Oct 5 09:00:19 CEST 2011


Hi,

The tricky issue with animating to a particular index in a ListView is it is not straightforward to calculate where an item might be located in a view. Unlike in a GridView, the sizes of items and section headers may change at any time. So positionViewAtIndex() takes a rough guess at where the item may be placed, and does a refill to layout the view at that point so that the view does indeed appear to be positioned at the correct point. 

Also, positionViewAtIndex() was designed to not animate the content y since without it, there was no way to jump to a content Y without drawing all the items in between, which is obviously expensive for very long lists. Although, for shorter lists, it would be nice to have perhaps another method, e.g. moveToIndex() or such, that could guess the new position and animate to that position.

regards,

Bea


On 05/10/2011, at 12:38 AM, ext Mark Tucker wrote:

> Hello,
>  
> I have had precisely the same problem when trying to implement "paged" navigation on a ListView - I've had to work around it by directly modifying the ContentX/Y, which I know is not recommended, but it's the only way I know of achieving such an effect.
>  
> As far as I am aware, it's not possible to specify an animation to happen when you use positionViewAtIndex (which I actually consider to be an oversight).
>  
> Though if anyone else can tell me that I'm wrong, I'd be more than happy to hear your solution :)
>  
> Thanks
>  
> Mark T
>  
> From: qt-qml-bounces+mark.tucker=airborne.aero at qt.nokia.com [mailto:qt-qml-bounces+mark.tucker=airborne.aero at qt.nokia.com] On Behalf OfBartosh Wroblevksy
> Sent: 04 October 2011 11:42
> To: qt-qml at qt.nokia.com
> Subject: [Qt-qml] smooth scrolling using positionViewatIndex
>  
> Hi,
> I apologize in advance if this is in the documentation. I wanted to know if it is possible to apply a NumberAnimation effect when using positionViewAtIndex on a GridView. I would like to have something like this
> Behavior on ContentY {
>          NumberAnimation { duration:1000 )
> }
>  
> The problem is that even if the method positionViewAtIndex modifies ContentY, the above lines that specify it's behavior have no effect. 
> Thanks,
> Bartosh
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml



More information about the Qt-qml mailing list