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

文章来自:http://www.cnblogs.com/findumars/p/5689990.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3