How to change the header background color of a QTableView

You can set the style sheet on the QTableView

ui->tableView->setStyleSheet("QHeaderView::section { background-color:red }");

for more info see http://doc.qt.io/qt-4.8/stylesheet-examples.html

原文地址:https://www.cnblogs.com/liujx2019/p/10516236.html