[Qt-qml] smooth scrolling using positionViewatIndex
Adriano Rezende
adriano.rezende at openbossa.org
Wed Oct 19 02:09:17 CEST 2011
On Wed, Oct 5, 2011 at 10:05 PM, <bea.lam at nokia.com> wrote:
>
> On 05/10/2011, at 7:30 PM, ext Bartosh Wroblevksy wrote:
>
>>Unlike in a GridView, the sizes of items and section headers may change at
>> any time.
>
> Not sure I understand because I am looking to animate the
> positionViewatIndex on precisely a GridView. You have this on the home
> screen of Android and Iphone when you flick from one page to the next. There
> must be a way to do this in QML.
>
> Great, with a GridView it's a lot easier, because all items have the same
> width and height, as determined by cellWidth and cellHeight, so you can
> calculate the appropriate contentY yourself and just animate using that.
> With a ListView, you can do the same if you know that item sizes will never
> change and if there are no section headers.
>
> Outside of looking for a particular index, I have had trouble in the past to
> simply modify the ContentY property of a ListView. The ListView would simply
> do nothing when the that property would change.
>
> Changing the contentY of a ListView should trigger any animations that have
> been set for the property, so I'm not sure what the issue was there.
I've opened a bug some time ago that is somewhat related to this:
https://bugreports.qt.nokia.com/browse/QTBUG-21358
When implementing a desktop scrollbar, one needs to implement a dual
feedback (Listview > Scrollbar and Scrollbar > Listview) in a pixel
wise manner. The problem is that contentX/contentY are not reliable,
since they just reflect the contentItem position without taking into
account the initial empty space left by deleted delegates. There are
some annoying workarounds to handle this, but I think it's something
that needs to be fixed in the ListView API.
Br,
Adriano
More information about the Qt-qml
mailing list