You might have looked at the QTabWidget and QTabBar settings .
To create individual tabs depending on their state (: only one ,: first, last, middle, previous selected, next selected, selected), you can use a style code like this:
QTabBar::tab { border: 1px solid #C4C4C3; border-bottom-color: #C2C7CB; border-top-left-radius: 4px; border-top-right-radius: 4px; padding: 1px 3px; margin-left: 1px; margin-bottom: 4px; } QTabBar::tab:selected { background-color: #f14040; border-bottom-style: none; }
Since individual tabs are not widgets (or objects), they do not have an object name or other properties that could identify them in the styling. You can use pseudo-classes only for style tabs with a style sheet.
You may have to use (C ++) code to change the style of the tab depending on the label. The recommended way to customize styles in Qt is through the QStyle class. You can use a subclass of QStyle or use QProxyStyle to change the appearance of certain widgets. Another alternative (possibly not recommended by Qt) is to subclass QTabBar and override the QWidget::paintEvent( QPaintEvent *event) function.
source share