[Qt-qml] Struggling with PathView, missing positionViewAtIndex?

thorbjorn.lindeijer at nokia.com thorbjorn.lindeijer at nokia.com
Thu Sep 30 23:02:25 CEST 2010


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?

Thanks for your time,
Bjørn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PathViewTest.qml
Type: application/octet-stream
Size: 5059 bytes
Desc: PathViewTest.qml
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100930/6ae2d5f9/attachment.obj 


More information about the Qt-qml mailing list