Reputation: 30915
im trying to programmatic select and change the background color of all the columns of QStandardItemModel
i have this that paint me only the first column out of 5 that the row contains
// getting the rows
QStandardItem* standardItem = m_model->item(i);
//set the color i like all the row to be painted
standardItem->setBackground(QBrush(QColor(255,0,0)));
Upvotes: 0
Views: 1790
Reputation: 11648
Try this..
for(int i = 0; i<rowCount; ++i)
{
for(int j = 0; j<columnCount; ++j)
{
m_model->item(i,j)->setBackground(QBrush(QColor(255,0,0)));
}
}
This isn't tested.. check it out..
Upvotes: 1