Qt表格

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( );

posted @ 2018-09-16 21:40  雪落梅藏  阅读(290)  评论(0编辑  收藏  举报