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?
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);
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));
I would try this way:
QTabWidget tabWidget;
tabWidget.setStyleSheet("QTabBar::tab:selected { color: #ffffff; }");
In my example this works!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.