void QTableWidgetItem::setData ( int role, const QVariant & value ) and look at doc for explanation of roles (Qt::ItemDataRole).
void QTableWidgetItem::setData ( int role, const QVariant & value ) and look at doc for explanation of roles (Qt::ItemDataRole).
Sarol (12th May 2011)
You cannot change the colour of individual cell contents from Designer.
The colour of cell content in a QTableView is driven by data returned from the model (with the default delegate). You want your underlying model to return a value in the Qt::ForegroundRole or Qt::BackgroundRole that is based on the value of the cell. Look into the the model/view examples and docs.
You could also address this with a custom delegate attached to the view if it is not appropriate/possible that the model return colour information globally.
Sarol (12th May 2011)
m.p and ChrisW67,
Thank you for giving me some direction on this matter. I have not worked with the Qt::ForegroundRole or Qt::BackgroundRole yet, but at least its a starting place to research this.
Thanks again,
Sarol
Bookmarks