Keep a potential's wire number for a new wire drawn from a cable core

inheritedProperties() cleared the text of a conductor held by a cable,
on the premise that CableManager writes the core label into it. It
writes it into m_cable only (Conductor::setCableReference()); the text
is the potential's real wire number. Clearing it lost a typed number on
the new wire and made distinctProperties() see a choice between ""
and the number where the potentials agreed. The text is now cleared only
when it repeats the core label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DaTweety
2026-10-18 22:46:25 +02:00
parent a0e2193971
commit 7fa242a55f
+6 -5
View File
@@ -134,10 +134,10 @@ bool ConductorCreator::needsPotentialChoice(const QList<Terminal *> &terminals_l
/**
@brief ConductorCreator::inheritedProperties
The properties a new wire takes from @p conductor's potential. A
cable's core names the cable and the core in m_cable, m_cable_uuid,
m_cable_slot and, written by CableManager, in its text (15W1:BN): none
of that belongs to a new wire, which is in no cable yet. The text is
then left to the formula.
cable's core names the cable and the core in m_cable, m_cable_uuid
and m_cable_slot (written by CableManager): none of that belongs to a
new wire, which is in no cable yet. The text is the potential's wire
number and is kept, unless it only repeats the core label.
@param conductor : a conductor of the potential
@return the properties for a new conductor of that potential
*/
@@ -146,10 +146,11 @@ ConductorProperties ConductorCreator::inheritedProperties(const Conductor *condu
ConductorProperties properties = conductor->properties();
if (!properties.m_cable_uuid.isNull())
{
if (properties.text == properties.m_cable)
properties.text.clear();
properties.m_cable.clear();
properties.m_cable_uuid = QUuid();
properties.m_cable_slot = -1;
properties.text.clear();
}
return properties;
}