待到山花烂漫时,依旧是那些经典在微笑 ~__~
分类: C/C++
2014-10-16 11:16:17
//QTreeWidget 遍历 treeWidget定义省略
int i = 0;
while(treeWidget->topLevelItem(i) != 0){
qDebug()<<"***********************";
qDebug()<<"column--"<<(treeWidget->topLevelItem(i)->columnCount());//获取列数
int k = 0, j = treeWidget->topLevelItem(i)->columnCount();
for(;k < j;k++){//每一行的内容
qDebug()<<"--"<"--"<<(treeWidget->topLevelItem(i)->text(k));
}
//指定内容
qDebug()<<"--"<"######"<<(treeWidget->topLevelItem(i)->data(DataModel::devType, Qt::UserRole).toString());
i++;//行数
qDebug()<<"***********************";
}