Hi all,
I am having a QListView which having some items. Now i want to get the index of selected item. i.e. if i select 5th element i should get 5. How i can get this?..
waiting for reply.
Thanks in advance
-S
Hi all,
I am having a QListView which having some items. Now i want to get the index of selected item. i.e. if i select 5th element i should get 5. How i can get this?..
waiting for reply.
Thanks in advance
-S
There is no easy way to do this, since QListView can handle tree like structures. You can make your list items derive from QListViewItem and add an extra data member to hold an index. You have to reset the indexes when sorting of course.
Hey,
In every view in Qt, you have the following method :
QItemSelectionModel * QAbstractItemView::selectionModel () const
Basically, it returns a model on which you can perform actions, like getting selected indexes...
Have a look here : QItemSelectionModel
You'll find plenty of methods to help you get your index(es).
Hope it helps!