'Install an event filter to capture mouse events in the tabs of a
QTabBar holding tabified dockwidgets.'

def install_tab_event_filter(self, value):

    dock_tabbar = None
    tabbars = self.main.findChildren(QTabBar)
    for tabbar in tabbars:
        for tab in range(tabbar.count()):
            title = tabbar.tabText(tab)
            if (title == self.title):
                dock_tabbar = tabbar
                break
    if (dock_tabbar is not None):
        self.dock_tabbar = dock_tabbar
        if (getattr(self.dock_tabbar, 'filter', None) is None):
            self.dock_tabbar.filter = TabFilter(self.dock_tabbar, self.main)
            self.dock_tabbar.installEventFilter(self.dock_tabbar.filter)
