I am having a QListView which contains 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?
I am having a QListView which contains some items. Now I want to get
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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!