QT 关于QTableView的应用和管理
1、基本设置
QVector<QString> vecTableHeader;
int TableHeaderSize= vecTableHeader.size();
TableIndex = TableHeader.indexOf("告警内容");
//初始化实时告警表格
model_Test = new QStandardItemModel();
model_Test->setColumnCount(TableHeaderSize);
for (int i = 0; i < TableHeaderSize; i++ )
{
model_Test ->setHeaderData(i, Qt::Horizontal, TableHeader.at(i));
}
ui->tableViews->stModel(model_Test );
ui->tableViews->verticalHeader()->setVisible(false);//hide row head
ui->tableViews->horizontalHeader()->setVisible(true);//hide clum head
ui->tableViews->setEditTriggers(QAbstractItemView::NoEditTriggers);//forbiden edit
ui->tableViews->verticalHeader()->setDefaultSectionSize(40); //set row default hight
SetHisTableHeaderWith(TableIndex, TableHead