mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-30 06:34:13 +02:00
Make auto_num_locked/potential_isolating case-insensitive
Reviving the still-relevant part of #785, closed 2026-09-10 purely to clear a review backlog, not on merit. Investigated fresh against current master -- one of the original PR's three targets turned out to already be fixed independently: element_nomenclature_view's SQL predicate for exclude_from_bom already does "COALESCE(LOWER(TRIM(ei.exclude_from_bom)), '') NOT IN ('true', '1', 'yes', 'on')" (projectDataBase::createElementNomenclatureView()). auto_num_locked and potential_isolating had no equivalent: five call sites across terminal.cpp, terminalnumberingdialog.cpp and elementinfowidget.cpp compared the raw stored string against the literal "true" with QString::operator==, silently treating "True", "TRUE", a trailing space, or any value written by something other than this app's own checkbox as off -- with no error and no visible difference from the checkbox being genuinely unticked. Added QET::infoFlagIsTrue(), matching the same accepted spellings ("true"/"1"/"yes"/"on", case-insensitive, trimmed) the SQL predicate already uses, and switched all five call sites to it. Verified the exact comparison logic in isolation, outside any QET build: 15 cases including "True", "TRUE", padded whitespace, "1", "yes", "on", and their false counterparts -- all correctly discriminated. Qt 6.10.2, ctest 13/13. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "terminalnumberingdialog.h"
|
||||
#include "ui_terminalnumberingdialog.h"
|
||||
#include "../qet.h"
|
||||
#include "../qetproject.h"
|
||||
#include "../diagram.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
@@ -34,7 +35,7 @@ TerminalNumberingDialog::TerminalNumberingDialog(QWidget *parent, QETProject *pr
|
||||
if (elmt->elementData().m_type == ElementData::Terminal) {
|
||||
// Ignore locked terminals
|
||||
DiagramContext info = elmt->elementInformations();
|
||||
if (info.value(QStringLiteral("auto_num_locked")).toString() == QLatin1String("true")) {
|
||||
if (QET::infoFlagIsTrue(info.value(QStringLiteral("auto_num_locked")).toString())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -158,7 +159,7 @@ QUndoCommand* TerminalNumberingDialog::getUndoCommand(QETProject *project) const
|
||||
DiagramContext info = elmt->elementInformations();
|
||||
|
||||
// Ignore locked terminals (if the user checked a 'lock' property)
|
||||
if (info.value(QStringLiteral("auto_num_locked")).toString() == QLatin1String("true")) {
|
||||
if (QET::infoFlagIsTrue(info.value(QStringLiteral("auto_num_locked")).toString())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user