2017-04-11 31 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

我在問題消息中添加了完整的解決方案,但它對我有很大的幫助。謝謝 :) –