[Qt-qml] Struggling with PathView, missing positionViewAtIndex?
Martin Jones
martin.jones at nokia.com
Mon Oct 4 09:11:53 CEST 2010
On Thu, 2010-09-30 at 23:02 +0200, ext thorbjorn.lindeijer at nokia.com
wrote:
> Dear all (QML experts, mostly),
>
> I'm trying to combine a ListView and a PathView using the Package element, and would like my items to be able to reparent from one to another.
>
> >From the PathView to the ListView works fine, I can use ListView::positionViewAtIndex to prepare the view when switching, and animate my items from the path view to the list view.
>
> However, when I try to do the same from the ListView to the PathView, I run into problems. I have not found a good way to position the PathView at the right place that makes the ParentChange actually apply correctly.
>
> * First I tried modifying the PathView::currentIndex, but the PathView wants to animate the offset to the new index (and setting the highlightMoveDuration to 0 just breaks it).
> * Then I tried modifying the PathView::offset, but this still causes problems for the items for which no delegates existed on the PathView.
>
> I've attached a small example demonstrating the problem. I am using the latest Qt 4.7 branch. To reproduce:
>
> * Switch from path to list mode by clicking the left item (possibly after scrolling the path left/right).
> * Notice the items are positioned correctly in the ListView to the right.
> * Notice how clicking the items in the ListView moves them back into the PathView correctly.
> * Go back to list state, and now scroll the list a bit before clicking to make them go back to the PathView
> * Notice how the positions get all messed up (items basically get stuck in the top-left corner)
>
> I don't really understand how this can happen. It seems to me that modifying the PathView::offset does not make sure the visible delegates are created and layed out correctly by the time the ParentChange tries to go into effect.
>
> Can this be solved somehow, or does PathView need a positionViewAtIndex, just like the ListView, so that it can be positioned correctly before the ParentChange happens?
Setting offset should work fine for PathView. I have logged a bug:
http://bugreports.qt.nokia.com/browse/QTBUG-14199
Martin.
More information about the Qt-qml
mailing list