Posted on 2011-06-01 15:16
点点滴滴 阅读(761)
评论(0) 编辑 收藏 引用 所属分类:
02 编程语言
1.使用QTableView增加行
tableBTRelations->setRowCount(0);
BuffTemplate::BuffGroups& pBuffGroups = pBuffRelationData->getBuffGroups();
for (BuffTemplate::BuffGroups::iterator iter = pBuffGroups.begin(); iter != pBuffGroups.end(); ++ iter)
{
int row = tableBTRelations->rowCount();
tableBTRelations->insertRow(row);
tableBTRelations->setItem(row, 0, new QTableWidgetItem(QString("Group")));
tableBTRelations->setItem(row, 1, new QTableWidgetItem(QString(AppEditorUtils::O2QString(*iter))));
}
BuffTemplate::BuffTemplates& pBuffTemplates = pBuffRelationData->getBuffTemplates();
for (BuffTemplate::BuffTemplates::iterator iter = pBuffTemplates.begin(); iter != pBuffTemplates.end(); ++ iter)
{
int row = tableBTRelations->rowCount();
tableBTRelations->insertRow(row);
tableBTRelations->setItem(row, 0, new QTableWidgetItem(QString("ID")));
tableBTRelations->setItem(row, 1, new QTableWidgetItem(QString(AppEditorUtils::O2QString(*iter))));
}
2.使用QTableView自适应内容
tableBTRelations->resizeColumnsToContents();