Persist elementInformations for Slave elements too

Making the Informations tab visible for Slave elements is only half the
change: ElementScene::toXml() writes the <elementInformations> block for
Simple, Master, Terminal and Thumbnail, and Slave was not in that list. It
is the only place in the tree that writes that block, so the editor would
have shown an editable tab for a slave, accepted whatever the user typed
into it, and dropped it silently on save.

Visible in the shipped collection, which matches the condition exactly:
0 of 75 slave elements carry an <elementInformations> block, against 41 of
70 terminal elements.

Adding Slave is safe in both directions. ElementData::fromXml() reads
<elementInformations> unconditionally, with no check on the base type, so
existing slave elements are unaffected and newly written ones load back
correctly. It also makes populateTree()'s PLC-slave branch reachable for
the first time -- the five PLC info rows it adds are stored in
m_informations, so until now they could not have been saved either.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-09-12 22:33:04 +12:00
parent 18477c22b5
commit b18904415e
+5
View File
@@ -479,8 +479,13 @@ const QDomDocument ElementScene::toXml(bool all_parts)
root.appendChild(m_element_data.kindInfoToXml(xml_document));
}
//Slave is in this list because the element editor offers the
//Informations tab for it, including the PLC-specific rows
//populateTree() adds for a PLC slave. Without it the editor would
//accept that data and silently drop it on save.
if (type_ == ElementData::Simple ||
type_ == ElementData::Master ||
type_ == ElementData::Slave ||
type_ == ElementData::Terminal ||
type_ == ElementData::Thumbnail)
{