标签:留空 net param resize 显示 sso ble ade span
在网上很容易知道自适应列宽,100%不留空显示,这里还是提下:
/*设置表格是否充满,即行末不留空*/
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
设置了100%不留空后的效果:
在QT5之前,只要通过下面的程序就可以实现自动等宽:
/*QT5版本之前设置自动等宽*/
ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
但是到了QT5这个是行不通了的,需通过下面的代码来设置:
/*设置tablewidget等宽*/
QHeaderView* headerView = ui->tableWidget->horizontalHeader();
headerView->setSectionResizeMode(QHeaderView::Stretch);
/*或者下面的代码*/
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
设置自动等宽之后的效果:
http://blog.csdn.net/freeape/article/details/48713393
标签:留空 net param resize 显示 sso ble ade span
原文地址:http://www.cnblogs.com/findumars/p/6294188.html