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

Attachment: PathViewTest.qml
Description: PathViewTest.qml

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to