@@ -63,6 +63,19 public: | |||
|
63 | 63 | } |
|
64 | 64 | else { |
|
65 | 65 | QStyledItemDelegate::paint(painter, option, index); |
|
66 | ||
|
67 | // Sets color depending on the state | |
|
68 | auto stateRoleData = index.data(VariableRoles::StateRole); | |
|
69 | if (stateRoleData.canConvert<StateData>()) { | |
|
70 | auto stateData = stateRoleData.value<StateData>(); | |
|
71 | ||
|
72 | auto color = QColor{stateData.value("color").toString()}; | |
|
73 | if (color.isValid()) { | |
|
74 | auto newOption = option; | |
|
75 | newOption.palette.setBrush(QPalette::Text, QBrush{color}); | |
|
76 | QStyledItemDelegate::paint(painter, newOption, index); | |
|
77 | } | |
|
78 | } | |
|
66 | 79 | } |
|
67 | 80 | } |
|
68 | 81 |
General Comments 0
You need to be logged in to leave comments.
Login now