我注意到QTreeWidget和QLabel有不同的边框样式-即使我试图调整样式表。当然,我可以同时更改这两种样式表,但理想情况下,我希望保留QTreeWidget的边框样式。如何使QLabel的边框看起来像QTreeWidget的边框?
MCVE片段:import sys
from PyQt5.QtWidgets import *
class widget(QWidget):
def __init__(self):
super().__init__()
treewidget = QTreeWidget(self)
label = QLabel(self)
label.setStyleSheet("background-color: white; border: 1px inset grey; min-height: 200px;")
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(treewidget, 1, 0)
grid.addWidget(label, 2, 0)
self.setLayout(grid)
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
f = widget()
sys.exit(app.exec_())
不带样式表:
MCVE片段生成窗口的屏幕截图:
我希望窗口的外观: