mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-13 08:14:13 +02:00
Write the cable XML only where it has something to carry
Two pieces of cable XML went into every file the program saved, whether the project had cables or not (non-blocking review comment by ispyisail). Resaving one of the example projects added both of them. - <cable_autonums> is now written only when it holds something: a named rule, an axis other than the default, the numbering question answered with no, or a rule of its own. When it is missing, the reader falls back to exactly the defaults a project which never touched cable numbering has, so nothing changes for those files. That is deliberately not "only when the project has cables", which would cost data: a rule configured before the first cable is drawn and an axis chosen before it are answers only this element can carry, and the question answered with no has to survive even if the cable which prompted it was cancelled again. - the font attribute of <xref> is now written only when there is one. Only the cable cross-reference has a font of its own; writing it unconditionally put font="" on every cross-reference type of every project, and an absent attribute reads back as no font, which is what all the others are. Verified by resaving examples/741.qet, examples/Projet_vierge.qet and examples/affuteuse_250h.qet: before, cable_autonums=1 and font="" on each; after, none of them. A cable project of the reviewer's own keeps <cable_autonums axis_priority="y" current_autonum="Cable"> with its rule and its real fonts, and only loses the four empty font attributes. ctest 92/93, the one failure being the pre-existing headless tst_menubarkeyboard.
This commit is contained in:
@@ -172,7 +172,14 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const
|
||||
xml_element.setAttribute("master_label", master_label);
|
||||
QString slave_label = m_slave_label;
|
||||
xml_element.setAttribute("slave_label", slave_label);
|
||||
xml_element.setAttribute("font", m_font);
|
||||
//Only the cable cross-reference has a font of its own, and only
|
||||
//it ever sets one. Writing the attribute unconditionally put
|
||||
//font="" on every cross-reference type of every project the
|
||||
//program saved; a file which does not hold the attribute reads
|
||||
//back as no font, which is what all of them are.
|
||||
if (!m_font.isEmpty()) {
|
||||
xml_element.setAttribute("font", m_font);
|
||||
}
|
||||
foreach (QString key, m_prefix.keys()) {
|
||||
xml_element.setAttribute(key % "prefix", m_prefix.value(key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user