Add editable "auto_num_locked"/"potential_isolating"/"exclude_from_bom"

checkboxes to the element editor

These elementInformation keys were previously only editable on an
already-placed instance (via ElementInfoWidget on the diagram side).
Since elementInformation values are seeded from the .elmt file's own
<elementInformations> block at placement time, a symbol author had no
proper way to set these as the *default* for every future placement --
only a workaround via the generic, unvalidated key/value tree.

Adds dedicated checkboxes to ElementPropertiesEditorWidget, mirroring
ElementInfoWidget's own labels/behavior: auto_num_locked and
potential_isolating inside the existing terminal-only group
(m_terminal_gb, shown only for ElementData::Terminal), exclude_from_bom
always visible regardless of type. Written after the generic tree loop
so they take precedence over any stale raw entry for the same key.
No new storage or file format change -- purely a missing editor UI for
an already-existing mechanism.
This commit is contained in:
Levi Jetzer
2026-08-19 17:58:16 +02:00
parent 5f83679756
commit 884ec4bbb9
2 changed files with 54 additions and 6 deletions
@@ -171,8 +171,17 @@ void ElementPropertiesEditorWidget::upDateInterface()
ui->m_terminal_func_cb->setCurrentIndex(
ui->m_terminal_func_cb->findData(
m_data.m_terminal_function));
const DiagramContext &info = m_data.m_informations;
ui->m_auto_num_locked_cb->setChecked(
info.value(QStringLiteral("auto_num_locked")).toString() == QLatin1String("true"));
ui->m_potential_isolating_cb->setChecked(
info.value(QStringLiteral("potential_isolating")).toString() == QLatin1String("true"));
}
ui->m_exclude_from_bom_cb->setChecked(
m_data.m_informations.value(QStringLiteral("exclude_from_bom")).toString() == QLatin1String("true"));
on_m_base_type_cb_currentIndexChanged(ui->m_base_type_cb->currentIndex());
}
@@ -366,8 +375,8 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted()
m_data.m_slave_type = ui->m_type_cb->currentData().value<ElementData::SlaveType>();
}
m_data.m_contact_count = ui->m_number_ctc->value();
}
else if (m_data.m_type == ElementData::Master) {
} else if (m_data.m_type == ElementData::Master)
{
m_data.m_master_type = ui->m_master_type_cb->currentData().value<ElementData::MasterType>();
//If the checkbox is checked, save the number; otherwise, -1 (infinity)
@@ -382,13 +391,12 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted()
} else {
readSlaveGroupsFromTable();
}
}
else if (m_data.m_type == ElementData::Terminal)
} else if (m_data.m_type == ElementData::Terminal)
{
m_data.m_terminal_type = ui->m_terminal_type_cb->currentData().value<ElementData::TerminalType>();
m_data.m_terminal_function = ui->m_terminal_func_cb->currentData().value<ElementData::TerminalFunction>();
}
for (QTreeWidgetItem *qtwi : ui->m_tree->invisibleRootItem()->takeChildren())
{
QString txt = qtwi->text(1);
@@ -399,7 +407,17 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted()
m_data.m_informations.addValue(qtwi->data(0, Qt::UserRole).toString(),
txt);
}
if (m_data.m_type == ElementData::Terminal)
{
m_data.m_informations.addValue(QStringLiteral("auto_num_locked"),
ui->m_auto_num_locked_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
m_data.m_informations.addValue(QStringLiteral("potential_isolating"),
ui->m_potential_isolating_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
}
m_data.m_informations.addValue(QStringLiteral("exclude_from_bom"),
ui->m_exclude_from_bom_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
this->close();
}
@@ -54,6 +54,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="m_exclude_from_bom_cb">
<property name="styleSheet">
<string>margin: 5px; font-weight: bold;</string>
</property>
<property name="text">
<string>Exclure de la nomenclature</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_slave_gb">
<property name="title">
@@ -229,6 +239,26 @@
<item row="1" column="1">
<widget class="QComboBox" name="m_terminal_func_cb"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="m_auto_num_locked_cb">
<property name="styleSheet">
<string>margin: 5px; font-weight: bold;</string>
</property>
<property name="text">
<string>Verrouiller la numérotation automatique</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="m_potential_isolating_cb">
<property name="styleSheet">
<string>margin: 5px; font-weight: bold;</string>
</property>
<property name="text">
<string>Séparation de potentiel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>