QgsLayoutItemBaseWidget class

A base class for property widgets for layout items.

All layout item widgets should inherit from this base class.

Base classes

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

Constructors, destructors, conversion operators

QgsLayoutItemBaseWidget(QWidget*parent SIP_TRANSFERTHIS, QgsLayoutObject* layoutObject)
Constructor for QgsLayoutItemBaseWidget, linked with the specified layoutObject.

Public functions

auto layoutObject() -> QgsLayoutObject*
Returns the layout object associated with this widget.
void setDesignerInterface(QgsLayoutDesignerInterface* iface) virtual
Sets the the layout designer interface in which the widget is being shown.
auto setItem(QgsLayoutItem* item) -> bool
Sets the current item to show in the widget.
void setReportTypeString(const QString& string) virtual
Sets the string to use to describe the current report type (e.g.

Protected functions

auto coverageLayer() const -> QgsVectorLayer*
Returns the current layout context coverage layer (if set).
auto layoutAtlas() const -> QgsLayoutAtlas*
Returns the atlas for the layout (if available)
void registerDataDefinedButton(QgsPropertyOverrideButton* button, QgsLayoutObject::DataDefinedProperty property)
Registers a data defined button, setting up its initial value, connections and description.
auto setNewItem(QgsLayoutItem* item) -> bool virtual
Attempts to update the widget to show the properties for the specified item.
void updateDataDefinedButton(QgsPropertyOverrideButton* button)
Updates a previously registered data defined button to reflect the item's current properties.

Function documentation

void QgsLayoutItemBaseWidget::setDesignerInterface(QgsLayoutDesignerInterface* iface) virtual

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

bool QgsLayoutItemBaseWidget::setItem(QgsLayoutItem* item)

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.

void QgsLayoutItemBaseWidget::setReportTypeString(const QString& string) virtual

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.

void QgsLayoutItemBaseWidget::registerDataDefinedButton(QgsPropertyOverrideButton* button, QgsLayoutObject::DataDefinedProperty property) protected

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

The corresponding property key must be specified.

bool QgsLayoutItemBaseWidget::setNewItem(QgsLayoutItem* item) virtual protected

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.