Reputation: 113
I have found the common way to style a QTabBar content background with a stylesheet is like:
QTabWidget QWidget {
background-color: green;
}
The result would be like the desired one:
But problem is that QWidget also applies the background color to all objects inside the QTabWidget, that is, QToolButtons, QPushButtons, QFrames, etc... It's a pain in the ass for me because I need to apply once again all the background to my elements that are placed inside the tabs like:
QTabWidget QPushButton,
QTabWidget QToolButton {
background-color: red;
}
... (and so on)
I don't think it is a smart solution because I also have nested QTabWidgets so it turns crazy because I need to "reset" all backgrounds element each time I nest a new QTabWidget inside the previous one...
I would be perfect to have access to the direct element or subelement "background"... Any idea?
Thank you
Upvotes: 0
Views: 1726
Reputation: 113
This is the better solution I found:
QTabWidget::pane {
background-color: red;
}
Upvotes: 0
Reputation: 1211
Try this:
QTabWidget QStackedWidget > QWidget
{
background-color: green;
}
Upvotes: 2