title: PyQt: How to get listItem Index after ListView's onDrop()
body: <p>This example creates a simple dialog window with two drag-and-drop enabled listWidgets (thanks ekhumoro!).
  On dropEvent the droppedOnA() and droppedOnB() functions print out an information: what listWidgets the items came from and what indexes they used to have. But I need to find what indexes the dropped listItems assigned after they were dropped onto a QListWidget-receiver. I would appreciate if it would be explained how to achieve this.</p>
  
  <pre><code>from PyQt4 import QtGui, QtCore
  import sys, os
  
  class MyClass(object):
          def __init__(self):
              super(MyClass, self).__init__()               
  
  class ThumbListWidget(QtGui.QListWidget):
      _drag_info = []
      def __init__(self, type, name, parent=None):
          super(ThumbListWidget, self).__init__(parent)
          self.setObjectName(name)
          self.setIconSize(QtCore.QSize(124, 124))
          self.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
          self.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
          self.setAcceptDrops(True)
  
      def startDrag(self, actions):
          self._drag_info[:] = [str(self.objectName())]
          for item in self.selectedItems():
              self._drag_info.append(self.row(item))
          super(ThumbListWidget, self).startDrag(actions)
  
      def dragEnterEvent(self, event):
          if event.mimeData().hasUrls():
              event.accept()
          else:
              super(ThumbListWidget, self).dragEnterEvent(event)
  
      def dragMoveEvent(self, event):
          if event.mimeData().hasUrls():
              event.setDropAction(QtCore.Qt.CopyAction)
              event.accept()
          else:
              super(ThumbListWidget, self).dragMoveEvent(event)
  
      def dropEvent(self, event):
          if event.mimeData().hasUrls():
              event.setDropAction(QtCore.Qt.CopyAction)
              event.accept()
              links = []
              for url in event.mimeData().urls():
                  links.append(str(url.toLocalFile()))
              self.emit(QtCore.SIGNAL("dropped"), links)
          else:
              # event.setDropAction(QtCore.Qt.MoveAction)
              super(ThumbListWidget, self).dropEvent(event)
              self.emit(QtCore.SIGNAL("dropped"), self._drag_info )
  
  
  class Dialog_01(QtGui.QMainWindow):
      def __init__(self):
          super(QtGui.QMainWindow,self).__init__()
          self.listItems={}
  
          myQWidget = QtGui.QWidget()
          myBoxLayout = QtGui.QVBoxLayout()
          myQWidget.setLayout(myBoxLayout)
          self.setCentralWidget(myQWidget)
  
          self.listWidgetA = ThumbListWidget(self, 'MainTree')
          self.listWidgetB = ThumbListWidget(self, 'SecondaryTree')
  
          for i in range(7):
              listItemA=QtGui.QListWidgetItem()
              listItemA.setText('A'+'%04d'%i)
              self.listWidgetA.addItem(listItemA)
  
              myClassInstA=MyClass()
              listItemA.setData(QtCore.Qt.UserRole, myClassInstA)
  
              listItemB=QtGui.QListWidgetItem()
              listItemB.setText('A'+'%04d'%i)
              self.listWidgetB.addItem(listItemB)
  
              myClassInstB=MyClass()
              listItemB.setData(QtCore.Qt.UserRole, myClassInstB)
  
          myBoxLayout.addWidget(self.listWidgetA)      
  
          myBoxLayout.addWidget(self.listWidgetB)   
          self.connect(self.listWidgetA, QtCore.SIGNAL("dropped"), self.droppedOnA)
          self.connect(self.listWidgetB, QtCore.SIGNAL("dropped"), self.droppedOnB)
  
  
      def droppedOnA(self, dropped_list):
          print '\n\t dropped On MainTree', dropped_list, 
  
      def droppedOnB(self, dropped_list):
          print '\n\t dropped On SecondaryTree', dropped_list
  
  
  if __name__ == '__main__':
      app = QtGui.QApplication(sys.argv)
      dialog_1 = Dialog_01()
      dialog_1.show()
      dialog_1.resize(720,480)
      sys.exit(app.exec_())
  </code></pre>