可以通过tabWidget->setStyleSheet方法,设置样式,包括tab的样式。
如
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 QTabWidget* m_MainTab; 2 m_MainTab->setStyleSheet("QTabWidget::pane{border-1px;border-color:rgb(96, 96, 96); 3 border-style: outset;background-color: rgb(96, 96, 96);} 4 QTabWidget::tab-bar{border-0px;} 5 QTabBar::tab{border-bottom-color: #FF0000; 6 border-top-left-radius: 0px; 7 border-top-right-radius: 0px; 8 min-100px; min-height:25px; 9 font:14px Times New Roman; 10 padding: 0px; 11 } 12 QTabBar::tab:!selected { 13 margin-top: 0px; margin-left: 30; 14 border-image: url(:/images/tab/sel3.png); 15 } 16 QTabBar::tab:selected { 17 color: blue; 18 border-image: url(:/images/tab/sel3.png); 19 } 20 QTabBar::tab:hover:!selected { 21 border-image: url(:/images/tab/sel3.png); 22 } 23 QTabBar::tab:selected { 24 margin-left: 10; 25 }");
找到的靠谱资料:
https://pastebin.com/08wFKNGP
https://www.cnblogs.com/findumars/p/4886330.html
https://bbs.csdn.net/topics/390632657?page=1