1

I'm developing a plugin that will enable the grid decorations(like copyright, scale bar) on the map canvas, but I don't find any clue on how to do it.

Just to clarify I don't want to create a grid inside a layer, I just want to enable the decorations grid as shown in the image below.

enter image description here

I've searched in the QGIS GUI and QgsMapCanvas API without any luck.

  • To draw the grid QGIS uses theQgsDecorationGrid class which is not exposed through the API. A workaround is well explained in this answer. Here is another link to give you an idea of which project entries you need to write to enable the grid: https://github.com/qgis/QGIS/blob/master/src/app/decorations/qgsdecorationgrid.cpp#L152-L163 – CodeBard Mar 15 '22 at 15:40
  • Thanks, @CodeBard, but the approach on the answer works when I save and reload the project. I need a workaround like in the cheat sheet, but for the QgsDecorationGrid. Unfortunately, I don't find yet what do I have to override in the grid render method to enable the grid without reloading the project. – Francisco Camello Mar 16 '22 at 12:33

0 Answers0