开发者

QT how to select and change all coulmns of QStandardItemModel

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))开发者_如何学JAVA);


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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜