I am using a QTableView with QAbstractTableModel.
I have subclassed QAbstractTableModel and in my model class for Qt::BackgroundRole and Qt::ForegroundRole I have returned some color depending on some condition.
And I have subclassed QTableView class.
When I select any row/cell on the table, the row/cell is highlighted in the default color of the tabelVeiw, it does not show the color returned from my model class.
How can I change this behavior? How can I avoid/ignore this default coloring of QTableView and have only the colors returned by my model class?
QTableView? - Dmitry SazonovQTableViewbecause in my case the table will react to left click, double click, and right click. Without subclassing, with the given signal slots if I implementQWidget::customContextMenuRequestedandQAbstractItemView::clickedthen if I right click it emits the click() signal as well. That is why I had to subclass QTableView and re-implementmousePressEventto differentiate left and right mouse click - Yousuf AzadQItemDelegateto handle mouse events. - Dmitry Sazonov