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