ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
视频:http://youtu.be/KBpf9oLxOq4
如何为所有字符串调整大小?
修改:ui->tableWidget->resizeColumnToContents(0);