ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);//表格列宽可拖动
ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Interactive);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(1,QHeaderView::ResizeToContents);//单元格根据内容扩充长度
ui->tableWidget->setColumnWidth(1,600); //指定列宽