遍历treeWidget节点,索引到要找的节点并选中
来源:互联网 发布:美工考核指标 编辑:程序博客网 时间:2024/06/05 07:10
void DevMainWindow::indexCurTreeItem(QModelIndex index){ QTableWidgetItem *tableItem = ui->tableWidget->item(index.row(), 5); qDebug() << "item.text:::" << tableItem->text(); itemText1 = ui->tableWidget->item(index.row(), 3)->text(); itemText2 = ui->tableWidget->item(index.row(), 4)->text(); int iNum, jNum, kNum; QTreeWidgetItem *item1, *item2, *item3; //根节点下所有子节点的个数 iNum = root->childCount(); //遍历根节点下的所有子节点 for (int i = 0; i < iNum; i++){ //根节点下当前遍历到的子节点 item1 = root->child(i); //判断该节点是否是要找的节点 if (item1->text(0) == itemText1){ jNum = item1->childCount(); for (int j = 0; j < jNum; j++){ item2 = root->child(i)->child(j); if (item2->text(0) == itemText2){ kNum = item2->childCount(); for (int k = 0; k < kNum; k++){ item3 = root->child(i)->child(j)->child(k); if (item3->text(0) == tableItem->text()){ //找到目标节点并设为选中状态 ui->treeWidget->setCurrentItem(item3); } } } } } }}
0 0
- 遍历treeWidget节点,索引到要找的节点并选中
- TreeView的子节点和父节点级联选中,遍历TreeView并查找和选定节点
- Qt删除TreeWidget节点
- 遍历TreeView得到选中的节点
- net2005中,树的加载,遍历,选中特定的节点
- 递归遍历树视图控件选中的节点
- MzTreeView 递归遍历 设置指定节点 选中
- VFS的索引节点
- VFS的索引节点
- Jquery的节点遍历
- 树节点的遍历
- DOM2节点的遍历
- zTree异步展开父节点并选中指定子节点
- CTreeCtrl 右键选中节点并显示菜单
- CTreeCtrl 右键选中节点并显示菜单
- c# 右键并选中treeview节点
- Ext TreePnael选中节点及获取选中的节点
- 层次遍历二叉树,并输出节点所在的行数
- hadoop环境搭建
- 验证码
- C 函数中调用Lua函数时,对于lua_pcall使用的困惑
- 计算机网络之面试常考
- 第三周项目4—顺序变应用问题(1)
- 遍历treeWidget节点,索引到要找的节点并选中
- 为什么调用 lua_pcall
- android sdk更新
- Python 基础语法_Python脚本文件结构
- 技术人生:故事之十五NT,UNIX?
- C中调用Lua函数
- A Translation for Quaternion 一篇对四元数的翻译
- Lua中调用C函数
- SpringMvc+Mybatis简单测试