Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
5.12.0, 5.15.2, 6.3.0
-
None
-
macOS 10.14.3
Description
QHeaderView on macOS Mojave is too narrow and does not paint the top and bottom horizontal lines found on native tree views.
A minimum working example in PySide2 is:
import sys from PySide2 import QtWidgets app = QtWidgets.QApplication(sys.argv) tree_widget = QtWidgets.QTreeWidget() tree_widget.setColumnCount(3) layout = QtWidgets.QGridLayout() layout.addWidget(tree_widget) window = QtWidgets.QWidget() window.setLayout(layout) window.show() sys.exit(app.exec_())
This can be fixed with the following style sheet, which gives approximately the right appearance:
QHeaderView {
border: 1px solid rgb(183, 183, 183);
background: rgb(240, 240, 240);
border-left: 0px; border-right: 0px;
font-size: 11pt;
}
QHeaderView::section {
height: 18;
border: 0px;
background: rgb(240, 240, 240);
padding-left: 10px;
}
QHeaderView::section:horizontal{
margin-top: 3px;
margin-bottom: 3px;
border-right: 1px solid rgb(212, 212, 212);
}