From 622791f99440c4f7657e5470c78180b929fdf460 Mon Sep 17 00:00:00 2001 From: Levi Jetzer Date: Fri, 21 Aug 2026 15:59:06 +0200 Subject: [PATCH] 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. --- .../ui/elementpropertieseditorwidget.cpp | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index ee4789bf7..391a14ba1 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -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(); }