2017-04-11 33 views
1

我想要一个TabBar那样但我不需要设置TabBar的哪些参数? (我希望只使用样式表)如何使用自定义witdh = max自定义QTabBar的选项卡标题? (qt样式表)

我尝试这样做:

QTabWidget::tab-bar { 

    background-color: blue; 

    min-width:2000; 

    with:2000; 

    height:50; 

} 

但也有在屏幕上没有任何变化

enter image description here

这是一个完整的解决方案:

QTabWidget QTabBar{ 
background-color: #136ba2; 
width: 256px; 
font: 10pt "Arial"; 
} 

QTabWidget QTabBar::tab{ 
background-color: #136ba2; 
height: 50px; 
width: 256px; 
color: #e6e6e6; 
} 

QTabWidget QTabBar::tab:selected{ 
background-color: #0f5d90; 
width: 256px; 
} 

QTabBar::tab:last { 
    border-top-right-radius: 3px; 
    border-bottom-right-radius: 3px; 
    margin-right: 678px; 
} 
+0

你能更好地解释它是什么,你想,告诉你试过吗? – eyllanesc

+0

没关系。请阅读我的更新评论 –

回答

1

而不是使用QTabWidget::tab-bar{}尝试使用QTabWidget QTabBar{}。要设置更多特定属性,请使用::tab选择器。

例如:

QTabWidget QTabBar{background-color: #136ba2; min-width: 2000px;} 
QTabWidget QTabBar::tab{background-color: #136ba2; height: 50px; color: #e6e6e6} 
QTabWidget QTabBar::tab:selected{background-color: #0f5d90;} 
+1

我在问题消息中添加了完整的解决方案,但它对我有很大的帮助。谢谢 :) –