0
点赞
收藏
分享

微信扫一扫

Qt之自定义QTabWdidget,类似QQ


QTabWidget的tab选项卡宽度是按照文本自动设置的,文本越长选项卡的宽度越大,但是QQ的选项卡是等分填充的,如下所示:

Qt之自定义QTabWdidget,类似QQ_选项卡


因此我们也需要将各个选项卡等分填充,下面是我模仿的 

Qt之自定义QTabWdidget,类似QQ_QTabWidget_02

 完整的样式表如下:

  QTabBar::tab {
height:40px;
color:#000000;
background:transparent;
font-family:"微软雅黑";
font-size:14px;
margin-left: 12px;
margin-right: 12px
}
QTabBar::tab:hover{
color:rgb(0,190,169);
background:transparent;
font-family:"微软雅黑";
font-size:14px;
}
QTabBar::tab:selected{
color:rgb(0,190,169);
background:transparent;
font-family:"微软雅黑";
font-size:14px;
border-bottom:2px solid rgb(0,190,169);
}
QTabBar{
qproperty-usesScrollButtons:false;
qproperty-documentMode:true;
qproperty-expanding:true;
}

其中最后一段用于实现等分填充


QTabWidget的tab选项卡宽度是按照文本自动设置的,文本越长选项卡的宽度越大,但是QQ的选项卡是等分填充的,如下所示:

Qt之自定义QTabWdidget,类似QQ_选项卡


因此我们也需要将各个选项卡等分填充,下面是我模仿的 

Qt之自定义QTabWdidget,类似QQ_QTabWidget_02

 完整的样式表如下:

  QTabBar::tab {
height:40px;
color:#000000;
background:transparent;
font-family:"微软雅黑";
font-size:14px;
margin-left: 12px;
margin-right: 12px
}
QTabBar::tab:hover{
color:rgb(0,190,169);
background:transparent;
font-family:"微软雅黑";
font-size:14px;
}
QTabBar::tab:selected{
color:rgb(0,190,169);
background:transparent;
font-family:"微软雅黑";
font-size:14px;
border-bottom:2px solid rgb(0,190,169);
}
QTabBar{
qproperty-usesScrollButtons:false;
qproperty-documentMode:true;
qproperty-expanding:true;
}

其中最后一段用于实现等分填充

举报

相关推荐

0 条评论