Qt QTableWidget Header Color

763 views Asked by At

I would like to change the color of a vertical header cell in a QTableWidget.

Here is my (failed) attempt:

QTableWidgetItem* vHeaderItem = new QTableWidgetItem;
vHeaderItem->setBackgroundColor(QColor("yellow"));
ui.tableWidget->setVerticalHeaderItem(r, vHeaderItem);

I have no idea why this wouldn't work.

1

There are 1 answers

1
Neox On

This should work:

vHeaderItem->setBackgroundColor(Qt::yellow);