'Insert a tab at `index`'

def insertTab(self, index, text, icon=None, toolTip=None):

    button = TabButton(self, objectName='tab-button')
    button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
    button.setIconSize(self.__iconSize)
    button.setMouseTracking(True)
    self.__group.addButton(button)
    button.installEventFilter(self)
    tab = _Tab(text, icon, toolTip, button, None, None)
    self.layout().insertWidget(index, button)
    self.__tabs.insert(index, tab)
    self.__updateTab(index)
    if (self.currentIndex() == (-1)):
        self.setCurrentIndex(0)
    return index
