Code below populate a treewidget. TO change the design of the rows in treewidget, we add CSS like codes to stylesheet of the treewidget like below:
self.treeWidget = QTreeWidget()
# my_delegate = MyDelegate(self)
stylesheet = ("""QTreeView::item {padding: 2px;
border-bottom: 1px solid black;
}
QTreeView::item:selected {
background-color: black;
}""")
If we set Gray in here, nothing happens when a row is selected:
QTreeView::item:selected {
background-color: Gray;
}
But if we change the colour to Blue or any other colours, the style of the selected row becomes unusual! There will be dotted borders all over the cells where we select in that selected row!
Why this issue does not happen with Gray? How we can set other colours without facing problems?
Please have a look at the selected Blue row. The cell has a dotted border!
The Gray row is clean without dotted border
Blue
Gray
I would like to change the colour of the selected row without those dotted border.
PHITON is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.