[SOLVED] PathView: accessing delegate at current index
-
wrote on 24 Nov 2011, 11:48 last edited by
I have PathView filled with the list of delegates. How do I access a delegate at current index?
-
wrote on 24 Nov 2011, 12:46 last edited by
Question is: why would you need to? Sounds like you are trying to do something imperative, when you should be doing something declarative instead... But, I could very well be wrong, of course.
-
wrote on 24 Nov 2011, 12:57 last edited by
I have a carousel view implemented with PathView. Here is the example it is based on:
http://developer.qt.nokia.com/wiki/Qt_Quick_CarouselThe thing is that I need to make one of the items special by sending an event from outside of the PathView. I have a button which suppose to make a current item special when pressed. PathView provides me with the curentIndex, but it seems there is no way to access the current item itself. Or is there?
-
wrote on 24 Nov 2011, 13:03 last edited by
Should be easy to solve. Every delegate has access to it's index, and can access any other non-dynamic item in the scene by id. So, why don't you just put the index number that works as the "special" index as a property in an index somewhere, and let the delegates determine based on that if they are The Chosen One? Or, alternatively, you might simply make it a property of the model itself.
-
wrote on 24 Nov 2011, 14:15 last edited by
Thanks for the idea! It works now. Solved by adding additional property to the listModel, and then modifying it according to the current index of PathView:
@onClicked: listModel.setProperty(pathview.currentIndex, "active", true)@
1/5