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