Qt学习4 删除xml某个标签下所有子标签

    
     QDomElement flowChart = listFlowChart.at(0).toElement();
     QDomNodeList listAllNodes = flowChart.childNodes();
     while (listAllNodes.size() > 0)
    {
              flowChart.removeChild(listAllNodes.at(0));
     }

  注意:不能用for循环来移除标签。因为从listAllNode中每移除一个标签,listAllNode.size()都会减一

posted @ 2023-01-04 15:07  ai在西元前  阅读(197)  评论(0)    收藏  举报