Reputation:
I'm not talking about the stuff within the tab, but the tab itself. Aside from it looking weird, I'd like to closely emulate Mac's native look.
Here's a screenshot of some system settings
and here's a pic of what I have.
I've tried
QTabWidget tabWidget;
tabWidget.setStyleSheet("color: #ffffff");
but that just changes all the text within the tab widget itself. Any help?
Upvotes: 1
Views: 6979
Reputation: 2134
I used this way:
tabWidget->tabBar()->setStyleSheet("QTabBar::tab:selected {\
color: #00ff00;\
background-color: rgb(0,0,255);\
}");
or, for only one tab:
tabWidget->tabBar()->setTabTextColor(1,Qt::white);
Upvotes: 2
Reputation: 2020
I would try this way:
QTabWidget tabWidget;
tabWidget.setStyleSheet("QTabBar::tab:selected { color: #ffffff; }");
In my example this works!
Upvotes: 0
Reputation: 4181
You can use style Sheet like this:
ui->tabWidget->setStyleSheet("color: rgb(119, 133, 255);");
Or use QTabWidget functions for specific item:
ui->tabWidget->item(i,j)->setTextColor(QColor(color));
ui->tabWidget->item(i,j)->setBackgroundColor(QColor(color));
Upvotes: 0