QetElementEditor : Use elementData class

This commit is contained in:
joshua
2021-02-13 21:38:36 +01:00
parent ffe3d98279
commit 8f85cacb06
15 changed files with 354 additions and 335 deletions

View File

@@ -554,3 +554,30 @@ void QETXML::modelHeaderDataFromXml(
model->setHeaderData(section_, orientation_, data_, role_);
}
}
/**
* @brief QETXML::findInDomElement
* @param dom_elmt
* @param tag_name
* @return all direct child of dom_elmt with tag name tag_name
*/
QVector<QDomElement> QETXML::findInDomElement(const QDomElement &dom_elmt, const QString &tag_name)
{
QVector<QDomElement> return_list;
for (auto node = dom_elmt.firstChild() ;
!node.isNull() ;
node = node.nextSibling())
{
if (!node.isElement()) {
continue;
}
auto element = node.toElement();
if (element.isNull() || element.tagName() != tag_name) {
continue;
}
return_list << element;
}
return(return_list);
}