Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[solved] ListView how to get new/old row when I drag and drop



  • My application has two identical ListViews of QStandardItems(text+icon). the first list is a source of Items and I can drag items(copy) from this list to the second one. In the second list I can move the items (Drag&Drop). Everything works fine. My problem is that when I change the position (row) of one item in the second list I have to reorder some internal structure which is linked to the rows position of the specific items. So, I need to re-index the Listview. I read a lot of documentation about Drag and Drop (non really clear compared to other subjects) but I am still trying to understand what is the right approach. I have tried to subclass the ListView and re-implement the DragEnterEvent and DropEvent...but not sure this is the right strategy for what I need to achieve...
    If somebody can give me some direction...it would be very much appreciated.
    Thanks G.