1

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.

4

1 回答 1

0

这应该有效:

vHeaderItem->setBackgroundColor(Qt::yellow);
于 2012-02-02T08:49:00.230 回答