How to get the Index from a ListView
-
wrote on 4 Jan 2018, 21:08 last edited by
I'm trying to get the index from a listview when I dragging the item to over.
I'm using listview.currentIndex but I always get 0 as an index.
I have also tried using the delegateId.ListVeiw.currentIndex , I get a reference error ReferenceError.I need the index so that I may remove the Item from the return index.
Any help is appreciated.
-
I'm trying to get the index from a listview when I dragging the item to over.
I'm using listview.currentIndex but I always get 0 as an index.
I have also tried using the delegateId.ListVeiw.currentIndex , I get a reference error ReferenceError.I need the index so that I may remove the Item from the return index.
Any help is appreciated.
-
wrote on 4 Jan 2018, 22:34 last edited by
@JonB said in How to get the Index from a ListView:
QListView
Thanks for the reply, JonB.Here is an Image that would help you understand what I'm trying to accomplish.
ListView in on the right and I'm dragging it over to the Item on the left.
When dragging the from the ListView to the Play Item, I want to know the Index of the ListView Item I'm dragging over to the other the Play Item. -
@JonB said in How to get the Index from a ListView:
QListView
Thanks for the reply, JonB.Here is an Image that would help you understand what I'm trying to accomplish.
ListView in on the right and I'm dragging it over to the Item on the left.
When dragging the from the ListView to the Play Item, I want to know the Index of the ListView Item I'm dragging over to the other the Play Item.wrote on 4 Jan 2018, 22:47 last edited by JonB 1 Apr 2018, 22:49ListView in on the right and I'm dragging it over to the Item on the left.
?? ListView on left and dragging item over to widget at right ??
This appears to be the opposite way round from what I first understood you to be saying. You seem to be dragging an item out of the listview to somewhere else, not dragging something else over on top of a listview item.
-
ListView in on the right and I'm dragging it over to the Item on the left.
?? ListView on left and dragging item over to widget at right ??
This appears to be the opposite way round from what I first understood you to be saying. You seem to be dragging an item out of the listview to somewhere else, not dragging something else over on top of a listview item.
-
wrote on 5 Jan 2018, 09:34 last edited by
in the play area you'll have a drop event that contains the QMimeData with the information you need
-
wrote on 8 Jan 2018, 18:55 last edited by
I was able to figure out how to access the index.
I was trying to access it via listview.currentIndex, but that only seems to work when using the keyboard arrow keys to move between items. If you are using the mouse then index from the ListModel it what you want use.
1/7