Fix problem that not all childs were added to the xml document

This commit is contained in:
Martin Marmsoler
2020-10-03 20:50:08 +02:00
parent 9521a8aa0b
commit f3368f159d
2 changed files with 6 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ QDomElement PartTerminal::toXml(QDomDocument &xml_document) const {
// Do not store terminal data in its own child // Do not store terminal data in its own child
QDomElement terminalDataElement = d->toXml(xml_document); QDomElement terminalDataElement = d->toXml(xml_document);
for (int i=0; i < terminalDataElement.childNodes().length(); i++) { for (int i=0; i < terminalDataElement.childNodes().length(); i++) {
qdo.appendChild(terminalDataElement.childNodes().at(i)); qdo.appendChild(terminalDataElement.childNodes().at(i).cloneNode()); // cloneNode() is important, otherwise no deep clone is made
} }
return qdo; return qdo;

View File

@@ -734,9 +734,11 @@ QDomElement Terminal::toXml(QDomDocument &doc) const {
// Do not store terminal data in its own child // Do not store terminal data in its own child
QDomElement terminalDataElement = d->toXml(doc); QDomElement terminalDataElement = d->toXml(doc);
int y = terminalDataElement.().length(); // TODO: seems to be not correct!
for (int i=0; i < terminalDataElement.childNodes().length(); i++) { int childsCount = terminalDataElement.childNodes().count();
qdo.appendChild(terminalDataElement.childNodes().at(i)); for (int i=0; i < childsCount; i++) {
QDomNode node = terminalDataElement.childNodes().at(i).cloneNode(); // cloneNode() is important, otherwise no deep clone is made
qdo.appendChild(node);
} }
return(qdo); return(qdo);