From b882defb28ed96d0bbbd81ef17899cb53bcbb4d8 Mon Sep 17 00:00:00 2001 From: JamesJCode <13408010-JamesJCode@users.noreply.gitlab.com> Date: Thu, 6 Jun 2024 08:16:15 +0100 Subject: [PATCH] Update connectivity for SCH_LABELs if netclass field changed Required for https://gitlab.com/kicad/code/kicad/-/issues/17797 fix in 8.0. This was fixed in the rule area work in 8.99 but not cherry-picked as it was wrapped up in the wider changes / bugfixes. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17797 --- eeschema/sch_label.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_label.cpp b/eeschema/sch_label.cpp index 781512b854..98c7ecb9ae 100644 --- a/eeschema/sch_label.cpp +++ b/eeschema/sch_label.cpp @@ -1223,7 +1223,25 @@ bool SCH_LABEL_BASE::HasConnectivityChanges( const SCH_ITEM* aItem, if( GetPosition() != label->GetPosition() ) return true; - return GetShownText( aInstance ) != label->GetShownText( aInstance ); + if( GetShownText( aInstance ) != label->GetShownText( aInstance ) ) + return true; + + std::vector netclasses; + std::vector otherNetclasses; + + for( const SCH_FIELD& field : m_fields ) + { + if( field.GetCanonicalName() == wxT( "Netclass" ) ) + netclasses.push_back( field.GetText() ); + } + + for( const SCH_FIELD& field : label->m_fields ) + { + if( field.GetCanonicalName() == wxT( "Netclass" ) ) + otherNetclasses.push_back( field.GetText() ); + } + + return netclasses != otherNetclasses; }