我创建了这个界面:

我的问题是:如何使用我的样式表.消除这条过时的行?
黑框(objectname= mainTabBarWidget(QWidget))是垂直排列的。它有一个固定的高度(38 It ),从左到右包含这些元素: QToolButton、QTabBar、QToolButton和另一个QToolButton。
其样式表如下:
QWidget#mainTabBarWidget {
border-bottom: 1px solid black;
background-color: rgb(107, 102, 102);
}只要单击"+“QToolButton,就会创建一个新的Tab。QTabBar (称为tabBar)具有以下样式表:
QTabBar#tabBar{
left: 10px; /* move to the right by 5px */
border-bottom: none;
}
QTabBar::tab {
background-color: rgb(194, 180, 180);
border-top: 2px solid rgb(107, 102, 102);
border-left: 2px solid rgb(107, 102, 102);
border-right: 2px solid rgb(107, 102, 102);
border-bottom: none;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-left-radius: -8px;
border-bottom-right-radius: -8px;
min-width: 100px;
max-width: 100px;
height: 35px;
padding: 2px;
}
QTabBar::tab:hover {
background-color: rgb(216, 209, 209);
}
QTabBar::tab:selected {
background-color: rgb(243, 231, 231);
border-color: rgb(0, 0, 0);
}
QTabBar::scroller { /* the width of the scroll buttons */
border: none;
width: 20px;
background-color: rgba(0,0,0,55);
}
QTabBar::tear {
border: none;
background-color: rgba(222,221,15, 45);
width: 0px;
}
QTabBar::tab:disabled {
border: none;
}P.S.1.当添加3或4个制表符时,行也会消失。

P.S.2.我尝试将选项卡宽度设置为120 to,但当我添加其他选项卡并显示滚动按钮时,这一行将重新出现。

发布于 2017-03-15 06:42:40
我也有过类似的问题,但下面已经解决了。
http://doc.qt.io/qt-5/qtabbar.html#drawBase-prop
QTabBar::setDrawBase(false);https://stackoverflow.com/questions/28551058
复制相似问题