fix: remove empty elementInformation, but keep empty properties

This commit is contained in:
plc-user 2025-02-08 07:39:21 +01:00
parent f26733f34e
commit b8e4fca09f

View File

@ -151,7 +151,10 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const
void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const
{ {
foreach (QString key, keys()) { foreach (QString key, keys()) {
if (m_content[key].toString().trimmed().isEmpty()) { continue; } if ((tag_name == "elementInformation") &&
(m_content[key].toString().trimmed().isEmpty())) {
continue;
}
QDomElement property = e.ownerDocument().createElement(tag_name); QDomElement property = e.ownerDocument().createElement(tag_name);
// try to sort attributes by removing and re-adding // try to sort attributes by removing and re-adding
property.removeAttribute("show"); property.removeAttribute("show");