QTableWidegt用法
ui->tableWidget->setColumnCount(4);
ui->tableWidget->horizontalHeader()->setDefaultSectionSize(150);
ui->tableWidget->horizontalHeader()->setDefaultAlignment(Qt::AlignRight);//设置表文件位置,(居左、中右等)
![](https://i-blog.csdnimg.cn/blog_migrate/0fa455fdbfc1273e52c6219e82b73f71.png)
QFont font = ui->tableWidget->horizontalHeader()->font();
font.setBold(true);
ui->tableWidget->horizontalHeader()->setFont(font);
![](https://i-blog.csdnimg.cn/blog_migrate/14bd1f172b8bcddd55eae13bb601ecc8.png)
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
![](https://i-blog.csdnimg.cn/blog_migrate/ac43e593d6675c086dd4345b0515c83a.png)
ui->tableWidget->verticalHeader()->setResizeContentsPrecision(QHeaderView::Fixed);
ui->tableWidget->verticalHeader()->setDefaultSectionSize(25);
ui->tableWidget->setFrameShape(QFrame::