1

我想要一个这样的 TabBar,但我不知道我必须设置 TabBar 的哪些参数?(我只想使用样式表)

我试过这个:

QTabWidget::tab-bar {

    background-color: blue;

    min-width:2000;

    with:2000;

    height:50;

}

但屏幕上没有变化

在此处输入图像描述

这是完整的解决方案:

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;
}
4

1 回答 1

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;}
于 2017-04-11T16:21:49.040 回答