Class: QgsLayoutItemBaseWidget

A base class for property widgets for layout items.

All layout item widgets should inherit from this base class.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLayoutItemBaseWidget

Base classes

QgsPanelWidget

Base class for any widget that can be shown as an inline panel.

QWidget

QObject

QPaintDevice

Methods

coverageLayer

Returns the current layout context coverage layer (if set).

layoutAtlas

Returns the atlas for the layout (if available)

layoutObject

Returns the layout object associated with this widget.

registerDataDefinedButton

Registers a data defined button, setting up its initial value, connections and description.

setItem

Sets the current item to show in the widget.

updateDataDefinedButton

Updates a previously registered data defined button to reflect the item's current properties.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsLayoutItemBaseWidget. See the FAQ for more details.

setDesignerInterface

Sets the the layout designer interface in which the widget is being shown.

setMasterLayout

Sets the master layout associated with the item.

setNewItem

Attempts to update the widget to show the properties for the specified item.

setReportTypeString

Sets the string to use to describe the current report type (e.g. "atlas" or "report").

class qgis.gui.QgsLayoutItemBaseWidget[source]

Bases: QgsPanelWidget

__init__(parent: QWidget | None, layoutObject: QgsLayoutObject | None)

Constructor for QgsLayoutItemBaseWidget, linked with the specified layoutObject.

Parameters:
coverageLayer(self) QgsVectorLayer | None[source]

Returns the current layout context coverage layer (if set).

Return type:

Optional[QgsVectorLayer]

layoutAtlas(self) QgsLayoutAtlas | None[source]

Returns the atlas for the layout (if available)

Return type:

Optional[QgsLayoutAtlas]

layoutObject(self) QgsLayoutObject | None[source]

Returns the layout object associated with this widget.

Return type:

Optional[QgsLayoutObject]

registerDataDefinedButton(self, button: QgsPropertyOverrideButton | None, property: QgsLayoutObject.DataDefinedProperty)[source]

Registers a data defined button, setting up its initial value, connections and description. The corresponding property key must be specified.

Parameters:
virtual setDesignerInterface(self, iface: QgsLayoutDesignerInterface | None)[source]

Sets the the layout designer interface in which the widget is being shown.

Added in version 3.6.

Parameters:

iface (Optional[QgsLayoutDesignerInterface])

setItem(self, item: QgsLayoutItem | None) bool[source]

Sets the current item to show in the widget. If True is returned, item was an acceptable type for display in this widget and the widget has been updated to match item’s properties.

If False is returned, then the widget could not be successfully updated to show the properties of item.

Parameters:

item (Optional[QgsLayoutItem])

Return type:

bool

virtual setMasterLayout(self, masterLayout: QgsMasterLayoutInterface | None)[source]

Sets the master layout associated with the item.

Added in version 3.10.

Parameters:

masterLayout (Optional[QgsMasterLayoutInterface])

virtual setNewItem(self, item: QgsLayoutItem | None) bool[source]

Attempts to update the widget to show the properties for the specified item.

Subclasses can override this if they support changing items in place.

Implementations must return True if the item was accepted and the widget was updated.

Parameters:

item (Optional[QgsLayoutItem])

Return type:

bool

virtual setReportTypeString(self, string: str | None)[source]

Sets the string to use to describe the current report type (e.g. “atlas” or “report”). Subclasses which display this text to users should override this and update their widget labels accordingly.

Parameters:

string (Optional[str])

updateDataDefinedButton(self, button: QgsPropertyOverrideButton | None)[source]

Updates a previously registered data defined button to reflect the item’s current properties.

Parameters:

button (Optional[QgsPropertyOverrideButton])