diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 82ab8237f7..12f28370a5 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -49,6 +49,8 @@ #include #include +#include + /// This is a read only template that is copied and modified before adding to LAYER_WIDGET const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { @@ -420,8 +422,13 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); if( galCanvas ) { - KIGFX::VIEW* view = galCanvas->GetView(); - view->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled ); + if( aId == GRID_VISIBLE ) + { + galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() ); + galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); + } + else + galCanvas->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled ); } if( galCanvas && myframe->IsGalCanvasActive() )