QTabWidget的第二个tab怎么设置sheetStyle
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了QTabWidget的第二个tab怎么设置sheetStyle相关的知识,希望对你有一定的参考价值。
参考技术A 这个问题我也纠结过 实在是找不到设置第二个tab的方法后来是自己写个槽函数去替代解决
setStyleSheet("QTabBar::tab \
height: 45px;\
width: 60px;\
\
QTabBar::tab:selected\
background-color: rgb(51,51,51);\
\
QTabWidget::pane \
border: 1px solid #C2C7CB;\
background-color: rgb(51, 51, 51);\
\
");
connect(this,SIGNAL(currentChanged(int)),this,SLOT(tabSelectChanged(int)));
void AudioTabWidget::tabSelectChanged(int index)
switch(index)
case TAB_GRP: /*选中群组tab*/
this->setTabIcon(TAB_GRP,QIcon(":/res/icon/tab_grp_selected.png"));
this->setTabIcon(TAB_USER,QIcon(":/res/icon/tab_user_unselected.png"));
this->setTabIcon(TAB_CAMERA,QIcon(":/res/icon/tab_camera_unselected.png"));
this->setTabIcon(TAB_CLT,QIcon(":/res/icon/tab_collect_unselected.png"));
break;
case TAB_USER: /* 选中用户tab */
this->setTabIcon(TAB_GRP,QIcon(":/res/icon/tab_grp_unselected.png"));
this->setTabIcon(TAB_USER,QIcon(":/res/icon/tab_user_selected.png"));
this->setTabIcon(TAB_CAMERA,QIcon(":/res/icon/tab_camera_unselected.png"));
this->setTabIcon(TAB_CLT,QIcon(":/res/icon/tab_collect_unselected.png"));
break;
case TAB_CAMERA: /* 选中摄像头tab */
this->setTabIcon(TAB_GRP,QIcon(":/res/icon/tab_grp_unselected.png"));
this->setTabIcon(TAB_USER,QIcon(":/res/icon/tab_user_unselected.png"));
this->setTabIcon(TAB_CAMERA,QIcon(":/res/icon/tab_camera_selected.png"));
this->setTabIcon(TAB_CLT,QIcon(":/res/icon/tab_collect_unselected.png"));
break;
case TAB_CLT: /* 选中收藏tab */
this->setTabIcon(TAB_GRP,QIcon(":/res/icon/tab_grp_unselected.png"));
this->setTabIcon(TAB_USER,QIcon(":/res/icon/tab_user_unselected.png"));
this->setTabIcon(TAB_CAMERA,QIcon(":/res/icon/tab_camera_unselected.png"));
this->setTabIcon(TAB_CLT,QIcon(":/res/icon/tab_collect_selected.png"));
break;
default:
break;
本回答被提问者和网友采纳
以上是关于QTabWidget的第二个tab怎么设置sheetStyle的主要内容,如果未能解决你的问题,请参考以下文章