PDA

View Full Version : StyleSheet for TabBar



sdastagirmca
12th February 2009, 11:48
hi,

How to display different styles for each tab in Qt designer.i'm using the code




QTabBar::tab:first
{
background:red;
}
QTabBar::tab:last
{
background:white;
}



i want to display other color for 2nd ,3rd etc..


thanks in advance

talk2amulya
12th February 2009, 12:15
try

QTabBar page#1
{
/* ur color */
}
QTabBar page#2
{
/* ur color */
}

similarly u can give different colors to different pages in QTabBar, i.e. page#3, page#4..

sdastagirmca
12th February 2009, 13:03
hi

i have given like that but still its not working..

talk2amulya
12th February 2009, 13:11
could you please show what u wrote

sdastagirmca
12th February 2009, 13:19
i have wrote like this



QTabBar::tab:Page1
{
background:red;
}

talk2amulya
12th February 2009, 13:21
nope, try this


QTabBar Page#1
{
background:red;
}

QTabBar Page#2
{
background:white;
}

sdastagirmca
12th February 2009, 13:25
still its not working

talk2amulya
12th February 2009, 13:56
hey, i used the QTabWidget and it works with it in the following way:

QWidget#tab
{
background:#ededed;
}

QWidget#tab_2
{
background-color:#6c8bb6;
}

QWidget#tab_3
{
background-color:red;
}

QWidget#tab_4
{
background-color:#44638f;
}

where tab_2, tab_3 etc are the object names of each tab

sdastagirmca
13th February 2009, 05:02
hi,


I want to change color of the Tab bars

nifei
13th February 2009, 07:28
hi,


I want to change color of the Tab bars

I'm afraid single tab cannot be controlled by style sheet via specified object name. Since QTabbar::tab is not a widget but a sub control of QTabbar widget, just like QCheckBox::indicator and QListView::item cannot distinguished from other indicator or item. What user can distinguish from others is the state, such like selected and hover. for example:

QTabbar::tab:selected
{
}
QTabbar::tab:hover
{
}

sdastagirmca
13th February 2009, 09:41
hi


Its able to change the color of the first and last.But it is not possible for second tab.

thanks in advance

tferreira
15th May 2012, 16:45
It's this you want: https://bugreports.qt-project.org/browse/QTBUG-840

I've been trying to accomplish this as well, but without success.
If there's anyone that has been able to do this, please post your solution.