Skip to content

Commit

Permalink
Use QBrush when returning background color
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiesel authored and MinmoTech committed Jun 26, 2023
1 parent 56abdd6 commit 7414a6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addon/kanji_confirm_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
QModelIndex,
QVariant,
QVBoxLayout,
QBrush,
)

from . import util
Expand Down Expand Up @@ -53,10 +54,12 @@ def data(self, idx, role):
kanji = self.kanji[idx.row()]

if role == Qt.ItemDataRole.DisplayRole:
# This should be a QBrush, but we also use the method
return str(kanji)
if role == Qt.ItemDataRole.BackgroundRole:
state = self.states[kanji]
return QColor(self.state_colors[state])
return QBrush(QColor(self.state_colors[state]))

return QVariant()

def rowCount(self, _parent):
Expand Down

0 comments on commit 7414a6d

Please sign in to comment.