I am trying to set the background color of a QTableWidgetItem, but it doenst work? When I try to change the textcolor, it works without any problems..
Code:
void myWin::myFunction(int count, QVector<QColor> sampleInfoColor, QVector<QStringList> info)
{
...
sampleTable->setRowCount(count + 1);
QFont nameFont;
nameFont.setBold(true);
...
for(int i=0; i<count; i++)
{
...
QTableWidgetItem *name = new QTableWidgetItem("Text");
name->setFont(nameFont);
sampleTable->setItem(i+1, 0, name);
name->setBackground(sampleInfoColor[i]);
...
}
}
I also tried this, but it didnt work too..:
sampleTable.item(nRow, nCol)->setBackground(QColor);
What am I doing wrong?
Can you give this a try: