I'm trying to make the cells of a QTableView
look like 3D clickable buttons. So that when you click on a cell, the button looks pushed. Everyone seems to think I merely want to change the colour, I need to show images of a normal button, and a pushed button, that look 3-dimensional.
I have done this already with calling QTableView::setItemDelegate()
, with an appropriate ItemDelegate
that will change the background of the cell when it's clicked. However I'm stuck at this point because I want some cells to be different coloured buttons based on the data they contain. So a cell with a low number would be a red button, that's also red when it's clicked, and the other cells would be different colours.
I can set the colour of the button with the TableModel
, but once the button is clicked, there is no way for the ItemDelegate
to know that it's supposed to be a different colour than the rest. How can you link the two so the ItemDelegate
knows what colour it's supposed to be?
Also, is there simply a better way to make cells look like buttons?