1、设置QTableWidget或QTableView的首行首列背景色
->horizontalHeader()->setStyleSheet("QHeadView::section{background-color: rgb(231,231,231);}");
->verticalHeader()->setStyleSheet("QHeadView::section{background-color: rgb(231,231,231);}");
->setStyleSheet("background-color: rgb(231,231,231);");//首行首列可能会失效
2、自适应列宽和自动等宽
->horizontalHeader()->setSectionResizeMode( );