From b18904415e0a3575995a019eabb625a267a40f57 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sat, 12 Sep 2026 22:33:04 +1200 Subject: [PATCH] Persist elementInformations for Slave elements too Making the Informations tab visible for Slave elements is only half the change: ElementScene::toXml() writes the 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 block, against 41 of 70 terminal elements. Adding Slave is safe in both directions. ElementData::fromXml() reads 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 --- sources/editor/elementscene.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index a87a2b6e7..534d435c9 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -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) {