'Method called when a tab from a QTabBar has been moved.'

def tab_moved(self, event):

    if (not (event.buttons() & Qt.LeftButton)):
        self.to_index = None
        return
    self.to_index = self.dock_tabbar.tabAt(event.pos())
    if ((not self.moving) and (self.from_index != (-1)) and (self.to_index != (-1))):
        QApplication.setOverrideCursor(Qt.ClosedHandCursor)
        self.moving = True
    if (self.to_index == (-1)):
        self.to_index = self.from_index
    (from_index, to_index) = (self.from_index, self.to_index)
    if ((from_index != to_index) and (from_index != (-1)) and (to_index != (-1))):
        self.move_tab(from_index, to_index)
        self._fix_cursor(from_index, to_index)
        self.from_index = to_index
