Qt中設定QTableWidget的表頭高度
阿新 • • 發佈:2018-12-10
關鍵就是
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);