def indexAtPos(self, p):
        if self.tabRect(self.currentIndex()).contains(p):
            return self.currentIndex()
        for i in xrange(self.count()):
            if self.isTabEnabled(i) and self.tabRect(i).contains(p):
                return i
        return -1
TODO: add docstring
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/packages/spreadsheet/spreadsheet_tab.py/StandardWidgetTabBar.indexAtPos--crossover with--dataset/ETHPy150Open treasure-data/td-client-python/tdclient/user_api.py/UserAPI.add_apikey