Class: QgsLayoutDesignerInterface

A common interface for layout designer dialogs and widgets.

Provides a common interface and stable API for layout designer dialogs and widgets. This interface can be used by plugins and scripts to interact with open layout designer dialogs.

Note

Layout designer dialogs are transitory. They are created only on demand (when a user opens the dialog) and are deleted as soon as the user closes the dialog. There can be multiple designer dialogs open at any one time, and each is a separate instance of the dialog and QgsLayoutDesignerInterface. Accordingly, plugins must take care to react to newly created designer dialogs and apply their customizations to all newly created dialogs. This can be done by listening for the QgisInterface.layoutDesignerOpened signal. Plugins must also listen for the QgisInterface.layoutDesignerWillBeClosed signal and gracefully cleanup any customizations before the designer dialog is deleted.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLayoutDesignerInterface

Base classes

QObject

Methods

actionsToolbar

Returns a reference to the designer's "Actions" toolbar.

activateTool

Activates a standard layout designer tool.

addDockWidget

Adds a dock widget to the layout designer, in the specified dock area.

atlasMenu

Returns a reference to the designer's "Atlas" menu.

atlasPreviewEnabled

Returns whether the atlas preview mode is enabled in the designer.

atlasToolbar

Returns a reference to the designer's "Atlas" toolbar.

close

Closes the layout designer.

editMenu

Returns a reference to the designer's "Edit" menu.

itemsMenu

Returns a reference to the designer's "Items" menu.

lastExportResults

Returns the results of the last export operation performed in the designer.

layout

Returns the current layout displayed in the designer.

layoutMenu

Returns a reference to the designer's "Layout" menu.

layoutToolbar

Returns a reference to the designer's "Layout" toolbar.

masterLayout

Returns the master layout displayed in the designer.

messageBar

Returns the designer's message bar.

navigationToolbar

Returns a reference to the designer's "Navigation" toolbar.

removeDockWidget

Removes the specified dock widget from layout designer (without deleting it).

reportMenu

Returns a reference to the designer's "Report" menu.

selectItems

Selects the specified items.

setAtlasFeature

Sets the specified feature as the current atlas feature

setAtlasPreviewEnabled

Toggles whether the atlas preview mode should be enabled in the designer.

settingsMenu

Returns a reference to the designer's "Settings" menu.

showItemOptions

Shows the configuration widget for the specified layout item.

showRulers

Toggles whether or not the rulers should be visible in the designer.

view

Returns the layout view utilized by the designer.

viewMenu

Returns a reference to the designer's "View" menu.

window

Returns a pointer to the designer window.

Signals

layoutExported

Emitted whenever a layout is exported from the layout designer.

mapPreviewRefreshed

Emitted when a map item's preview has been refreshed.

Attributes

ToolMoveItemContent

ToolMoveItemNodes

class qgis.gui.QgsLayoutDesignerInterface[source]

Bases: QObject

__init__(parent: QObject | None = None)

Constructor for QgsLayoutDesignerInterface.

Parameters:

parent (Optional[QObject] = None)

class ExportResults[source]

Bases: object

Encapsulates the results of an export operation performed in the designer.

Added in version 3.20.

labelingResults

Returns the labeling results for all map items included in the export. Map keys are the item UUIDs (see QgsLayoutItem.uuid()).

Ownership of the results remains with the layout designer.

result

Result/error code of export.

class StandardTool

Bases: int

ToolMoveItemContent = 0
ToolMoveItemNodes = 1
actionsToolbar(self) QToolBar | None[source]

Returns a reference to the designer’s “Actions” toolbar.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutToolbar()

See also

atlasToolbar()

Added in version 3.4.

Return type:

Optional[QToolBar]

activateTool(self, tool: QgsLayoutDesignerInterface.StandardTool)[source]

Activates a standard layout designer tool.

Added in version 3.6.

Parameters:

tool (QgsLayoutDesignerInterface.StandardTool)

addDockWidget(self, area: Qt.DockWidgetArea, dock: QDockWidget | None)[source]

Adds a dock widget to the layout designer, in the specified dock area.

Note

See class documentation for notes regarding handling customization of designer dialogs.

Added in version 3.4.

Parameters:
  • area (Qt.DockWidgetArea)

  • dock (Optional[QDockWidget])

atlasMenu(self) QMenu | None[source]

Returns a reference to the designer’s “Atlas” menu.

Note that this may not exist or may be hidden if the designer is in report mode.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutMenu()

See also

editMenu()

See also

viewMenu()

See also

itemsMenu()

See also

reportMenu()

See also

settingsMenu()

Added in version 3.4.

Return type:

Optional[QMenu]

atlasPreviewEnabled(self) bool[source]

Returns whether the atlas preview mode is enabled in the designer.

Added in version 3.4.

Return type:

bool

atlasToolbar(self) QToolBar | None[source]

Returns a reference to the designer’s “Atlas” toolbar.

Note that this toolbar may not exist or may be hidden if the designer is in report mode.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutToolbar()

See also

actionsToolbar()

Added in version 3.4.

Return type:

Optional[QToolBar]

close(self)[source]

Closes the layout designer.

editMenu(self) QMenu | None[source]

Returns a reference to the designer’s “Edit” menu.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutMenu()

See also

viewMenu()

See also

itemsMenu()

See also

atlasMenu()

See also

reportMenu()

See also

settingsMenu()

Added in version 3.4.

Return type:

Optional[QMenu]

itemsMenu(self) QMenu | None[source]

Returns a reference to the designer’s “Items” menu.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutMenu()

See also

editMenu()

See also

viewMenu()

See also

atlasMenu()

See also

reportMenu()

See also

settingsMenu()

Added in version 3.4.

Return type:

Optional[QMenu]

lastExportResults(self) QgsLayoutDesignerInterface.ExportResults | None[source]

Returns the results of the last export operation performed in the designer.

May be None if no export has been performed in the designer.

Added in version 3.20.

Return type:

Optional[QgsLayoutDesignerInterface.ExportResults]

layout(self) QgsLayout | None[source]

Returns the current layout displayed in the designer.

See also

view()

Return type:

Optional[QgsLayout]

signal layoutExported[source]

Emitted whenever a layout is exported from the layout designer.

The results of the export can be retrieved by calling lastExportResults().

Added in version 3.20.

layoutMenu(self) QMenu | None[source]

Returns a reference to the designer’s “Layout” menu.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

editMenu()

See also

viewMenu()

See also

itemsMenu()

See also

atlasMenu()

See also

reportMenu()

See also

settingsMenu()

Added in version 3.4.

Return type:

Optional[QMenu]

layoutToolbar(self) QToolBar | None[source]

Returns a reference to the designer’s “Layout” toolbar.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

actionsToolbar()

See also

atlasToolbar()

Added in version 3.4.

Return type:

Optional[QToolBar]

signal mapPreviewRefreshed(map: QgsLayoutItemMap)[source]

Emitted when a map item’s preview has been refreshed.

Added in version 3.20.

Parameters:

map (QgsLayoutItemMap)

masterLayout(self) QgsMasterLayoutInterface | None[source]

Returns the master layout displayed in the designer.

See also

layout()

Return type:

Optional[QgsMasterLayoutInterface]

messageBar(self) QgsMessageBar | None[source]

Returns the designer’s message bar.

Return type:

Optional[QgsMessageBar]

navigationToolbar(self) QToolBar | None[source]

Returns a reference to the designer’s “Navigation” toolbar.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutToolbar()

See also

actionsToolbar()

See also

atlasToolbar()

Added in version 3.4.

Return type:

Optional[QToolBar]

removeDockWidget(self, dock: QDockWidget | None)[source]

Removes the specified dock widget from layout designer (without deleting it).

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

addDockWidget()

Added in version 3.4.

Parameters:

dock (Optional[QDockWidget])

reportMenu(self) QMenu | None[source]

Returns a reference to the designer’s “Report” menu.

Note that this may not exist or may be hidden if the designer is not in report mode.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutMenu()

See also

editMenu()

See also

viewMenu()

See also

itemsMenu()

See also

atlasMenu()

See also

settingsMenu()

Added in version 3.4.

Return type:

Optional[QMenu]

selectItems(self, items: Iterable[QgsLayoutItem])[source]

Selects the specified items.

Parameters:

items (Iterable[QgsLayoutItem])

setAtlasFeature(self, feature: QgsFeature)[source]

Sets the specified feature as the current atlas feature

Warning

it is the caller’s responsibility to ensure that feature is a feature from the layout’s current atlas coverage layer.

Added in version 3.14.

Parameters:

feature (QgsFeature)

setAtlasPreviewEnabled(self, enabled: bool)[source]

Toggles whether the atlas preview mode should be enabled in the designer.

Added in version 3.4.

Parameters:

enabled (bool)

settingsMenu(self) QMenu | None[source]

Returns a reference to the designer’s “Settings” menu.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutMenu()

See also

editMenu()

See also

viewMenu()

See also

itemsMenu()

See also

atlasMenu()

See also

reportMenu()

Added in version 3.4.

Return type:

Optional[QMenu]

showItemOptions(self, item: QgsLayoutItem | None, bringPanelToFront: bool = True)[source]

Shows the configuration widget for the specified layout item.

If bringPanelToFront is True, then the item properties panel will be automatically shown and raised to the top of the interface.

Added in version 3.4.

Parameters:
showRulers(self, visible: bool)[source]

Toggles whether or not the rulers should be visible in the designer.

Added in version 3.4.

Parameters:

visible (bool)

view(self) QgsLayoutView | None[source]

Returns the layout view utilized by the designer.

See also

layout()

Return type:

Optional[QgsLayoutView]

viewMenu(self) QMenu | None[source]

Returns a reference to the designer’s “View” menu.

Note

See class documentation for notes regarding handling customization of designer dialogs.

See also

layoutMenu()

See also

editMenu()

See also

itemsMenu()

See also

atlasMenu()

See also

reportMenu()

See also

settingsMenu()

Added in version 3.4.

Return type:

Optional[QMenu]

window(self) QWidget | None[source]

Returns a pointer to the designer window.

Added in version 3.4.

Return type:

Optional[QWidget]