PDA

View Full Version : QTabWidget + tab button color( how to set ? )



medved6
10th September 2010, 07:28
Hi Everybody.
How can I change the color of tab button?
I can change the color of tab( widget itself by setting up the pallete ) but cannot find the way to change tab button ( the button you press to change the tab ).


mTabWidget = new QTabWidget;
mTabWidget->setStyleSheet("QToolButton { border-width: 1px; border-style: solid; border-color: green; background-color: red;}");


does not work.

Also how can I change color of the rect around tabs ?
If I change border color of the tab widgets the overall border color still partially remains gray.


UPD:

problem solved ( found Customizing QTabWidget and QTabBar )

pavanbarot
10th September 2010, 10:53
simply give stylesheet to tab widget no need to write code for this. change stylesheet of TabWidget as below mentioned..


QTabBar::tab:selected {
color: #4FA600;
background-color: rgb(255,255,255);
}

QTabBar::tab:!selected {
color: rgb(255,255,255);
background-color: #4FA600;
border-bottom-color: #4FA600;
}


QTabWidget::pane { /*replace icon text as pane ok....*/
margin: 1px,1px,1px,1px;
background-color: rgb(255,255,255);
}

QTabBar::tab {
border: 2px solid rgb(0,149,48);
border-bottom-color: rgb(255,255,255);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
height: 40px;
width: 170px;
background-color: rgb(255,255,255);
}

QTabWidget{
background-color: rgb(255,255,255);
font: 75 14pt "Arial Rounded MT Bold";
}

QTabWidget::tab-bar {
left: 5px; /* move to the right by 5px */
bottom: -1px;
background-color: rgb(255,255,255); }

i m sure this will work nice....