code: def index_at_event(self, event):
          
          # find index at mouse position
          globalpos = event.globalPos()
          viewport = self.viewport()
          pos = viewport.mapFromGlobal(globalpos)
          return self.indexAt(pos)
docs: Get the index under the position of the given MouseEvent
  
          :param event: the mouse event
          :type event: :class:`QtGui.QMouseEvent`
          :returns: the index
          :rtype: :class:`QtCore.QModelIndex`
          :raises: None