QTabWidget and QTabBar.的文字的顏色設置,三種方法


see the code after subclassing
TabWidget::TabWidget(QWidget *parent): QTabWidget(parent),mousePressFlag(false)
{
bar=tabBar();
QPalette palette;
bar->installEventFilter(this);

palette.setColor(QPalette::Active,QPalette::Button ,QColor(0,0,255)); 
bar->setPalette(palette);
bar->setAutoFillBackground(true);
};

 

  1. TabWidget::TabWidget( QWidget *parent) : QTabWidget(parent){
  2. QPalette pal = tabBar()->palette;
  3. pal.setColor( QPalette::Window, QColor(0,0,255));
  4. tabBar()->setPalette(pal);
  5. }

tabWidget->setPalette(QPalette(Qt::red));

 

http://www.qtcentre.org/threads/2986-How-to-change-color-of-Tab-in-QTabWidget


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM