mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 10:04:13 +02:00
Merge master into feat/qetz-db-truth-v2
The .qetz files take this branch's side: it already holds #1473, and adds the folio parts to join(). qetscriptapi.cpp: #1456 gave setConductorProperty() the voltage that crosses a function separated terminal element; here that function hands its work to applyConductorProperties(), so the change goes there, with the properties captured before the pushes. The database path for folios not built already gives up at such a terminal, so it builds the folio and takes the same route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1239,6 +1239,10 @@ QString QetScriptApi::conductorProperty(int folioIndex, const QString &elementUu
|
||||
describes a potential and not one drawn segment. Setting it on one
|
||||
conductor and leaving the rest of the potential disagreeing would
|
||||
produce a file no GUI action could have produced.
|
||||
|
||||
One thing stops at a terminal element with its function separation
|
||||
enabled: every property but the voltage / protocol, which still
|
||||
crosses it (@see Conductor::functionSeparatedConductors).
|
||||
@return true if anything was changed, or if it already held that value
|
||||
*/
|
||||
bool QetScriptApi::setConductorProperty(int folioIndex, const QString &elementUuid,
|
||||
@@ -1275,7 +1279,11 @@ bool QetScriptApi::setConductorProperty(int folioIndex, const QString &elementUu
|
||||
*/
|
||||
bool QetScriptApi::applyConductorProperties(Conductor *conductor, const ConductorProperties &properties)
|
||||
{
|
||||
if (properties == conductor->properties()) return true; // already so
|
||||
//Captured before the pushes below: QPropertyUndoCommand applies on
|
||||
//push, so reading the properties afterwards would already give back
|
||||
//@a properties.
|
||||
const ConductorProperties before = conductor->properties();
|
||||
if (properties == before) return true; // already so
|
||||
|
||||
QSet<Conductor *> potential = conductor->relatedPotentialConductors(true);
|
||||
potential << conductor;
|
||||
@@ -1287,6 +1295,25 @@ bool QetScriptApi::applyConductorProperties(Conductor *conductor, const Conducto
|
||||
old_value.setValue(c->properties());
|
||||
new_value.setValue(properties);
|
||||
m_project->undoStack()->push(new QPropertyUndoCommand(c, "properties", old_value, new_value));
|
||||
}
|
||||
//The other side of a function separated terminal element gets the
|
||||
//voltage / protocol only: it is the one property that still
|
||||
//describes the electrical node rather than one side of it. And it
|
||||
//only arrives when this call really changed it -- before / after
|
||||
//is the edit, not the far wire's own value, which differs from it
|
||||
//just as often as not and would then be overwritten by every call,
|
||||
//colour included.
|
||||
for (Conductor *c : conductor->functionSeparatedConductors(true))
|
||||
{
|
||||
ConductorProperties separated_properties = c->properties();
|
||||
separated_properties.applyTensionProtocolChange(before, properties);
|
||||
if (separated_properties == c->properties())
|
||||
continue;
|
||||
|
||||
QVariant old_value, new_value;
|
||||
old_value.setValue(c->properties());
|
||||
new_value.setValue(separated_properties);
|
||||
m_project->undoStack()->push(new QPropertyUndoCommand(c, "properties", old_value, new_value));
|
||||
}
|
||||
m_project->undoStack()->endMacro();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user