Remove auto_num_locked/potential_isolating/exclude_from_bom checkboxes'

"false" writes, delete key instead

Unchecking a checkbox previously wrote the key with value "false"
rather than omitting it -- behaviorally identical to every consumer
(all three do a case-sensitive == "true" comparison), but left dead
entries cluttering the .elmt file, inconsistent with how other
elementInformation fields (manufacturer, designation) are only present
when actually set. Now removes the key entirely when unchecked.
This commit is contained in:
Levi Jetzer
2026-08-21 15:59:06 +02:00
parent 884ec4bbb9
commit 622791f994
@@ -410,13 +410,21 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted()
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"));
if (ui->m_auto_num_locked_cb->isChecked())
m_data.m_informations.addValue(QStringLiteral("auto_num_locked"), QStringLiteral("true"));
else
m_data.m_informations.remove(QStringLiteral("auto_num_locked"));
if (ui->m_potential_isolating_cb->isChecked())
m_data.m_informations.addValue(QStringLiteral("potential_isolating"), QStringLiteral("true"));
else
m_data.m_informations.remove(QStringLiteral("potential_isolating"));
}
m_data.m_informations.addValue(QStringLiteral("exclude_from_bom"),
ui->m_exclude_from_bom_cb->isChecked() ? QStringLiteral("true") : QStringLiteral("false"));
if (ui->m_exclude_from_bom_cb->isChecked())
m_data.m_informations.addValue(QStringLiteral("exclude_from_bom"), QStringLiteral("true"));
else
m_data.m_informations.remove(QStringLiteral("exclude_from_bom"));
this->close();
}