void NodeConfigDlg::initNodeTable() { m_pNodeTable = new QTableWidget(this); QStringList headerString; m_pNodeTable->setColumnCount(6); m_pNodeTable->setRowCount(2); QGridLayout *pGridLayOut = new QGridLayout(this); pGridLayOut->addWidget(m_pNodeTable, 0, 0); headerString<<"序号"<<"系统类型"<<"节点类型"<<"主机名"<<"A网"<<"B网"; m_pNodeTable->setHorizontalHeaderLabels(headerString); }
注意:修改表头的时候,必须要写在pGridLayOut的后面,如果写在GridLayOut的前面,则表头修改无效。