View Full Version : QTabBar tab color
Oleg
28th March 2010, 14:48
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.
Lykurg
28th March 2010, 20:55
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.
foxyproxy
29th March 2010, 08:01
You can use QTabBar::setTabTextColor ( int index, const QColor & color ) to set different colors for tabs.
Oleg
29th March 2010, 09:11
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
MyColorTabBar[tabIndex=1] {
background-color: red;
}
MyColorTabBar[tabIndex=2] {
background-color: green;
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.