obtaining the index from a ListView delegate



  • According to the ListView documentation, I should be able to grab the index number belonging to each index. What I want to do is display that number as text on each delegate item. The ListView documentation isn't very clear on how to get it (or maybe I'm just dense). Can anyone help?



  • @kgregory It should be as simple as using 'model.index' (or just 'index' if there's no name clashing inside the delegate). It's not ListView specific but can be found in the more general model/view documentation, at least in "Models and Views in Qt Quick". The ListView itself gives only 'ListView.isCurrentItem' attached property.



  • that worked, thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.