In this image:
I would like to access the actual tabs, rather than the content, so I can set a QPropertyAnimation on the actual tab when it is hovered on. I know how to get the hover event working, and I can get the tab index on the hover, I just can't access the actual tab when I hover on it. Is there a list of the tabs somewhere as an attribute of the QTabBar or the QTabWidget, or where can I find the tabs? Or do I have to subclass the addTab function to create the tabs individually?
Extra Info
- Using PyQt5.14.1
- Windows 10
- Python 3.8.0

You cannot access "tabs", as they are not objects, but an abstract representation of the contents of the tab bar list.
The only way to customize their appearance is by subclassing QTabBar and overriding the
paintEvent().In order to add an over effect, you have to provide a unique animation for each tab, so you have to keep track of all tabs that are inserted or removed. The
addTab,insertTabandremoveTabmethods are not valid options, since they are not used by QTabWidget. It uses insteadtabInserted()andtabRemoved(), so those are to be overridden too.This could be a problem with stylesheets, though, especially if you want to set fonts or margins.
Luckily, we can use the
qproperty-*declaration with custom PyQt properties, and in the following example I'm using them for the tab colors.Some final notes: