I am using a delegate to set one cell's background to be blue in tableView. The code like follows:
void Delegate::setModelData(some parameters)
{
QStandardItem *item = model->item(modelIndex);
item->setBackground(QBrush(Qt::blue));
item->setText("hello")
}
- In this sequence, setBackground is before setText, the text won't show.If I change the sequence, text can show.
- If I change the background in this way, the grid line of the table disappears, like following:
Though not very clear(blue background), you still can see in the last column, no grid-line to seperate the cell.
Could you please tell me what is wrong with these two problems, and how to solve them? Thank you very mush ahead.