修复了setmap的bug

This commit is contained in:
玉宇清音 2023-09-02 06:35:46 +08:00
parent 1576a3c0b0
commit fc86521d1e
1 changed files with 4 additions and 6 deletions

View File

@ -148,13 +148,11 @@ void XMLConfig::setMap(const QList<QString> &path, const QHash<QString, QString>
{ {
auto root = doc_ins.documentElement(); auto root = doc_ins.documentElement();
auto telm = rebuild_exists_elms(root, path); auto telm = rebuild_exists_elms(root, path);
auto childs = telm.childNodes(); auto childs = telm.elementsByTagName("list");
QList<QDomNode> nodes; for (auto idx = childs.count() - 1; idx >= 0; --idx) {
for(auto idx=0; idx<childs.count(); ++idx){ auto node = childs.at(idx);
auto child = childs.at(idx); telm.removeChild(node);
if(child.isElement() && child.toElement().tagName() == "map")
telm.removeChild(child);
} }
for(auto &key : map.keys()){ for(auto &key : map.keys()){