Qt中设置QTableWidget的表头高度

关键就是

ui->tableWidget->horizontalHeader()->setMinimumHeight(30);
ui->tableWidget->setHorizontalHeaderLabels(columnNames);
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableWidget->verticalHeader()->setVisible(false);
ui->tableWidget->verticalHeader()->setDefaultSectionSize(30);
ui->tableWidget->horizontalHeader()->setMinimumHeight(30);
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);

 

你可能感兴趣的:(Qt-学习笔记)