QTableView列单元格根据内容调整大小,表头可拖动,设置表头填充满,单元格单选
->setSectionResizeMode(ui->tableView->horizontalHeader()->ResizeToContents);
表头可拖动
ui->tableView->horizontalHeader()->setSectionsMovable(true);
设置表头填充满->setStretchLastSection(true);
单元格单选
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);