Styling tabs on tabWidget
Hi all,
I am trying to customize tabs on a tabWidget. I make so far
Code:
styleTabs.append("QTabBar::tab { width:120px; height:30px; color:#333399; font-family:Tahoma; font-size:14px; font-weight:bold; }");
styleTabs.append("QTabBar::tab:hover { border-top:2px solid #E68B2C; margin-top:-1px; }");
ui->tabWidget->setStyleSheet(styleTabs);
The problem is when I hover the properties are lost. I.e. my selected tab is white. When I hover it the background:white property is lost and the tab become gray. I want to inherit the properties somehow. How can I do that?
The other thing I want to do is to change the background color of all tabs that are not active. How can I match them?
And the third thing is to put background image on some element. I try
Code:
styleButton2.append("QPushButton { background-image:url('icon.png'); background-repeat:none; background-position:top left; }");
ui->pushButton_2->setStyleSheet(styleButton2);
The image is in the same folder as the project, header and c++ files.
Re: Styling tabs on tabWidget
The stylesheet you set with setStyleSheet() is the stylesheet that will be set for the widget, any previous style-sheets will be lost.
It must contain everything you want, including the white background.
Quote:
The other thing I want to do is to change the background color of all tabs that are not active.
What do you mean by not active? disabled or just with out focus?
Re: Styling tabs on tabWidget
Quote:
Originally Posted by
high_flyer
What do you mean by not active? disabled or just with out focus?
I mean with out focus. I managed that with tab for all and tab.selected for the active tab.