如何更改 qtabbar 空 space pyqt 的背景颜色
how to change background color for qtabbar empty space pyqt
我需要更改 QTabbar 的空白 space 的背景颜色,如下图所示,我已经可以使用样式 sheet 来更改标签栏,但它只更改标签而不是空白 space 选项卡旁边(红色边框区域)
我正在使用 PyQt
据我所知,您可以通过以下任一方式实现:
tabWidget->setStyleSheet("QTabBar { background-color: red; }");
tabWidget->setDocumentMode(true);
不过看起来不太好
或通过:
tabWidget->setAutoFillBackground(true);
QPalette pal = tabWidget->palette();
pal.setColor(QPalette::Window, Qt::red);
tabWidget->setPalette(pal);
或者只创建带有一些背景的 QWidget,然后在其上插入 QTabWidget。
我需要更改 QTabbar 的空白 space 的背景颜色,如下图所示,我已经可以使用样式 sheet 来更改标签栏,但它只更改标签而不是空白 space 选项卡旁边(红色边框区域)
我正在使用 PyQt
据我所知,您可以通过以下任一方式实现:
tabWidget->setStyleSheet("QTabBar { background-color: red; }");
tabWidget->setDocumentMode(true);
不过看起来不太好
或通过:
tabWidget->setAutoFillBackground(true);
QPalette pal = tabWidget->palette();
pal.setColor(QPalette::Window, Qt::red);
tabWidget->setPalette(pal);
或者只创建带有一些背景的 QWidget,然后在其上插入 QTabWidget。