QTableWidget的表头颜色设置

设置水平和垂直表头的颜色
ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{background:yellow;}");
ui->tableWidget->verticalHeader()->setStyleSheet("QHeaderView::section{background:yellow;}");

左上角两个表头相交的区域也设置成同样的颜色
ui->tableWidget->setStyleSheet("QTableCornerButton::section{background:yellow;}");

原文地址:https://www.cnblogs.com/ribavnu/p/4667301.html