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
This commit is contained in:
JamesJCode 2024-06-06 08:16:15 +01:00
parent 7d7decafd4
commit b882defb28
1 changed files with 19 additions and 1 deletions

View File

@ -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<wxString> netclasses;
std::vector<wxString> 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;
}