Skip to content

Commit a01f636

Browse files
committed
FEAT: add transparent borders around white gradient like other gradients (in combobox)
1 parent 4fc4f70 commit a01f636

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

larray_editor/arraywidget.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -669,20 +669,22 @@ def __init__(self, parent, data=None, readonly=False, bg_value=None, bg_gradient
669669
gradient_chooser.setMaximumSize(120, 20)
670670
gradient_chooser.setIconSize(QSize(100, 20))
671671

672-
# add white option
673672
pixmap = QPixmap(100, 15)
674-
pixmap.fill(Qt.white)
673+
pixmap.fill(Qt.transparent)
674+
painter = QPainter(pixmap)
675+
676+
# add white option
677+
# 1 (y) and 13 (height) instead of 0 and 15 to have a transparent border around/between the gradients
678+
painter.fillRect(0, 1, 100, 13, Qt.white)
675679
gradient_chooser.addItem(QIcon(pixmap), "white")
676680

677681
# add other options
678-
pixmap.fill(Qt.transparent)
679-
painter = QPainter(pixmap)
680682
for name, gradient in available_gradients[1:]:
681683
qgradient = gradient.as_qgradient()
682684

683685
# * fill with white because gradient can be transparent and if we do not "start from white", it skews the
684686
# colors.
685-
# * 1 and 13 instead of 0 and 15 to have a transparent border around/between the gradients
687+
# * 1 (y) and 13 (height) instead of 0 and 15 to have a transparent border around/between the gradients
686688
painter.fillRect(0, 1, 100, 13, Qt.white)
687689
painter.fillRect(0, 1, 100, 13, qgradient)
688690
gradient_chooser.addItem(QIcon(pixmap), name, gradient)

0 commit comments

Comments
 (0)