mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-11 13:43:13 +02:00
terminaldata: add No, Nc, Common types for SW contacts
Extend TerminalData::Type enum with three new semantic values: - No : Normally Open terminal of a switch (SW) contact - Nc : Normally Closed terminal of a switch (SW) contact - Common : Common terminal of a switch (SW) contact Update typeToString() and typeFromString() accordingly. Fully backward compatible: existing Generic/Inner/Outer types are unchanged. Elements without typed terminals fall back to the previous behavior (first 2 named terminals). terminal: expose terminalType() as public accessor Add Terminal::terminalType() returning the TerminalData::Type of this terminal. This allows crossrefitem and other consumers to filter terminals by semantic role (No, Nc, Common) without accessing TerminalData internals directly. terminaleditor: add No, Nc, Common entries to type combobox Expose the three new TerminalData types (No, Nc, Common) in the element editor UI so users can assign a semantic role to each terminal of a SW contact element. Also fix a pre-existing bug in updateForm() where m_type_cb was incorrectly using m_orientation_cb->findData() instead of m_type_cb->findData(), preventing the type from being restored correctly when selecting a terminal. terminaleditor: add No, Nc, Common entries to type combobox Expose the three new TerminalData types (No, Nc, Common) in the element editor UI so users can assign a semantic role to each terminal of a SW contact element. Also fix a pre-existing bug in updateForm() where m_type_cb was incorrectly using m_orientation_cb->findData() instead of m_type_cb->findData(), preventing the type from being restored correctly when selecting a terminal.
This commit is contained in:
@@ -174,6 +174,12 @@ QString TerminalData::typeToString(TerminalData::Type type)
|
||||
return QString("Inner");
|
||||
case Outer :
|
||||
return QString("Outer");
|
||||
case No :
|
||||
return QString("No");
|
||||
case Nc :
|
||||
return QString("Nc");
|
||||
case Common :
|
||||
return QString("Common");
|
||||
}
|
||||
return QString("Generic");
|
||||
}
|
||||
@@ -193,6 +199,12 @@ TerminalData::Type TerminalData::typeFromString(const QString &string)
|
||||
return TerminalData::Inner;
|
||||
} else if (string == "Outer") {
|
||||
return TerminalData::Outer;
|
||||
} else if (string == "No") {
|
||||
return TerminalData::No;
|
||||
} else if (string == "Nc") {
|
||||
return TerminalData::Nc;
|
||||
} else if (string == "Common") {
|
||||
return TerminalData::Common;
|
||||
} else {
|
||||
qDebug() << "TerminalData::typeFromString, argument string is invalid"
|
||||
" failsafe type 'TerminalData::Generic' is returned";
|
||||
|
||||
Reference in New Issue
Block a user