This is how i get the value of a selected cell:
self.value = index.sibling(index.row(), 1).data()
But how can i read the color of that selected row/cell that i have set previously while adding the item like this:
model.setData(model.index(row, 0), QBrush(Qt.yellow), Qt.BackgroundRole)
I need: if selected row is yellow: do something...
Thank you
CodePudding user response:
The default argument of data()
is the DisplayRole
, so if you need to retrieve another role you have to specify it:
self.value = index.sibling(index.row(), 1).data(Qt.BackgroundRole)