PDA

View Full Version : change row color with setData



ottoshmidt
3rd March 2011, 12:04
I can easily manipulate data in the QTableView cells with :


model->setDate(index, "somestring")

but I can't change other properties, like background color or smth:


model->setData(model->index(1,2) , QColor(Qt::blue), Qt::BackgroundColorRole); - doesn't work

it appears that only default role (Qt::EditRole) works for me in setData... is that's what's supposed to be or I am missing something?

wysota
6th March 2011, 09:11
The roles that "work" depend on the model. If your model doesn't support storing background colors, it will ignore all requests to set them.