Skip to content

Commit d2d4cfe

Browse files
committed
delegate bg color fix
1 parent 4b2f198 commit d2d4cfe

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

NodeGraphQt/widgets/properties_bin.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ def paint(self, painter, option, index):
1717
painter.setRenderHint(QtGui.QPainter.Antialiasing, False)
1818
painter.setPen(QtCore.Qt.NoPen)
1919

20-
painter.setBrush(QtCore.Qt.NoBrush)
20+
# draw background.
21+
bg_clr = option.palette.midlight().color()
22+
painter.setBrush(QtGui.QBrush(bg_clr))
2123
painter.drawRect(option.rect)
2224

25+
# draw border.
26+
border_width = 1
2327
if option.state & QtWidgets.QStyle.State_Selected:
2428
bdr_clr = option.palette.highlight().color()
2529
painter.setPen(QtGui.QPen(bdr_clr, 1.5))
@@ -28,10 +32,12 @@ def paint(self, painter, option, index):
2832
painter.setPen(QtGui.QPen(bdr_clr, 1))
2933

3034
painter.setBrush(QtCore.Qt.NoBrush)
31-
painter.drawRect(QtCore.QRect(option.rect.x() + 1,
32-
option.rect.y() + 1,
33-
option.rect.width() - 2,
34-
option.rect.height() - 2))
35+
painter.drawRect(QtCore.QRect(
36+
option.rect.x() + border_width,
37+
option.rect.y() + border_width,
38+
option.rect.width() - (border_width * 2),
39+
option.rect.height() - (border_width * 2))
40+
)
3541
painter.restore()
3642

3743

0 commit comments

Comments
 (0)