[QGIS-Developer] Plugin for Layout

Nyall Dawson nyall.dawson at gmail.com
Mon Sep 27 16:07:17 PDT 2021


On Sat, 25 Sept 2021 at 17:24, Raymond Nijssen <r.nijssen at terglobo.nl> wrote:
>
> Hi Zsolt,
>
> This code adds a button to the layout toolbar. I don't know of a way to
> add things to the layout menu as well.
>
>
>
>
> def designer_opened(designer):
>      tb = designer.actionsToolbar()
>      action = QAction('Push me!', parent=designer)
>      tb.addAction(action)
>
> iface.layoutDesignerOpened.connect(designer_opened)

Take a look at the code from the QGIS Cartography Tools plugin,
specifically around here:
https://github.com/north-road/qgis-cartography-tools/blob/master/cartography_tools/gui/layout_designer_hooks.py#L61

That plugin adds a bunch of hooks into different parts of the layout
designer and would be a good model to copy from.

Nyall

>
>
>
>
> By the way, you can add a grid to your layout map item and show
> coordinates. There a quite many options. Have you looked into that?
>
> Hope this helps,
> Raymond
>
>
>
> On 25-09-2021 08:04, Gal Zsolt wrote:
> > Hello List!
> >
> > I like to write a plugin to add map corner coordinates as label to the
> > layout.
> >
> > I write a python script wich do this.
> > I make a plugin where I  add a menu item to the Qgis main interface.
> > Work. This solution is ugly: I select a menu item to make on action on
> > other window (Layout designer window wiht may layout)!
> >
> > Now I like to add a menu item to edit menu in the
> > *LayoutDesignerInterface?*.
> >
> > Reading the Python Api documentation and the Cookbook I don't understand
> > how to make this.
> > Can someone help me where to find additional documentation about this?
> > I Google it without success.
> >
> > Thanks in advance for any help!
> >
> > Zsolt
> >
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list