Read a folio's freeze flags back as the words they are saved as

Diagram::toXml() writes freezeNewElement and freezeNewConductor as
"true"/"false", but Diagram::fromXml() read them with toInt(), which is
0 for both words. So "freeze new elements" and "freeze new conductors"
were off again on every folio after a project was saved and reopened,
since the day the flags were added.

Compare the attribute with "true" instead. The project-level flags in
QETProject already do this.

No file-format change: the attributes are written exactly as before,
and a file without them still loads with both flags off.

Tests: tst_foliofreezeflags runs the binary's --resave on a fixture
with one folio per combination (both, elements only, none, attributes
missing) and reads the saved attributes back. The two frozen folios
fail on master.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Beat Hangartner <beat@hangartners.ch>
This commit is contained in:
Beat Hangartner
2026-10-07 21:03:12 +02:00
parent ef795a21e5
commit 6b83fdf7b3
4 changed files with 157 additions and 2 deletions
+6 -2
View File
@@ -1614,10 +1614,14 @@ bool Diagram::fromXml(QDomElement &document,
m_conductors_autonum_name = root.attribute(QStringLiteral("conductorAutonum"));
// Load Freeze New Element
m_freeze_new_elements = root.attribute(QStringLiteral("freezeNewElement")).toInt();
// Written as "true"/"false" by toXml(), so compare the text:
// toInt() of either word is 0.
m_freeze_new_elements = root.attribute(QStringLiteral("freezeNewElement"))
== QLatin1String("true");
// Load Freeze New Conductor
m_freeze_new_conductors_ = root.attribute(QStringLiteral("freezeNewConductor")).toInt();
m_freeze_new_conductors_ = root.attribute(QStringLiteral("freezeNewConductor"))
== QLatin1String("true");
//Load Element Folio Sequential
folioSequentialsFromXml(root,