Hi, all.
I'm looking for an idea how to make QTabBar to have different color tabs. Qt's Style Sheet engine allows to specify styles for all/selected/first/last tabs, but not each one separately by index. Can anybody advise anything?
Thanks.
Printable View
Hi, all.
I'm looking for an idea how to make QTabBar to have different color tabs. Qt's Style Sheet engine allows to specify styles for all/selected/first/last tabs, but not each one separately by index. Can anybody advise anything?
Thanks.
You could subclass QTabBar and write your own paint event. Have a look inside the sources how the original paint even looks like. Then just alter the for loop which is painting the tabs.
You can use QTabBar::setTabTextColor ( int index, const QColor & color ) to set different colors for tabs.
QTabBar::setTabTextColor ( int index, const QColor & color ) sets text color, not tab background color.
Is there a way to implement stylesheet handler plugin for my own widget to has its own stylesheet? I'd like to have something like
Code:
MyColorTabBar[tabIndex=1] { background-color: red; } MyColorTabBar[tabIndex=2] { background-color: green; }