#include<QStandardItemModel>
QStandardItemModel *model = new QStandardItemModel();
ui->tableView->setModel(model);
model->setColumnCount(2);
model->setHeaderData(0,Qt::Horizontal,"卡号");
model->setHeaderData(1,Qt::Horizontal,"姓名");
ui->tableView->setModel(model);
ui->tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
水平对齐方式有:
Constant | Value | Description |
---|---|---|
Qt.A |