Update grid attributes after sorting.

Fixes https://gitlab.com/kicad/code/kicad/issues/11753
This commit is contained in:
Jeff Young 2022-06-08 13:48:19 +01:00
parent 34932e097c
commit 46fd32b738
1 changed files with 15 additions and 0 deletions

View File

@ -96,6 +96,14 @@ public:
void BuildAttrs()
{
for( wxGridCellAttr* attr : m_nameAttrs )
attr->DecRef();
m_nameAttrs.clear();
if( m_readOnlyAttr )
m_readOnlyAttr->DecRef();
m_readOnlyAttr = new wxGridCellAttr;
m_readOnlyAttr->SetReadOnly( true );
@ -124,11 +132,17 @@ public:
m_nameAttrs.push_back( attr );
}
if( m_typeAttr )
m_typeAttr->DecRef();
m_typeAttr = new wxGridCellAttr;
m_typeAttr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinTypeIcons(),
PinTypeNames() ) );
m_typeAttr->SetReadOnly( true );
if( m_shapeAttr )
m_shapeAttr->DecRef();
m_shapeAttr = new wxGridCellAttr;
m_shapeAttr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinShapeIcons(),
PinShapeNames() ) );
@ -1035,6 +1049,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnPinTableColSort( wxGridEvent& aEvent )
ascending = true;
m_dataModel->SortRows( sortCol, ascending );
m_dataModel->BuildAttrs();
}