Class: QgsLabelSettingsWidgetBase

Base class for widgets which allow customization of label engine properties, such as label placement settings.

Added in version 3.12.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLabelSettingsWidgetBase

Base classes

QgsPanelWidget

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

QWidget

QObject

QPaintDevice

Subclasses

QgsLabelLineAnchorWidget

A widget for customising label line anchor settings.

QgsLabelObstacleSettingsWidget

A widget for customising label obstacle settings.

QgsLabelRemoveDuplicatesSettingsWidget

A widget for customising label duplicate removal settings.

Methods

context

Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.

dataDefinedProperties

Returns the current data defined properties state as specified in the widget.

registerDataDefinedButton

Registers a data defined override button.

setDataDefinedProperties

Sets the current data defined properties to show in the widget.

Virtual Methods

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

createExpressionContext

setContext

Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.

setGeometryType

Sets the geometry type of the features to customize the widget accordingly.

updateDataDefinedProperties

Updates a data defined properties collection, correctly setting the values for any properties related to this widget.

Signals

auxiliaryFieldCreated

Emitted when an auxiliary field is created in the widget.

changed

Emitted when any of the settings described by the widget are changed.

class qgis.gui.QgsLabelSettingsWidgetBase[source]

Bases: QgsPanelWidget

__init__(parent: QWidget | None = None, vl: QgsMapLayer | None = None)

Constructor for QgsLabelSettingsWidgetBase.

Parameters:
  • parent (Optional[QWidget] = None) – parent widget

  • vl (Optional[QgsMapLayer] = None) – associated map layer

signal auxiliaryFieldCreated[source]

Emitted when an auxiliary field is created in the widget.

signal changed[source]

Emitted when any of the settings described by the widget are changed.

context(self) QgsSymbolWidgetContext[source]

Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.

See also

setContext()

Return type:

QgsSymbolWidgetContext

virtual createExpressionContext(self) QgsExpressionContext[source]
Return type:

QgsExpressionContext

dataDefinedProperties(self) QgsPropertyCollection[source]

Returns the current data defined properties state as specified in the widget.

Return type:

QgsPropertyCollection

registerDataDefinedButton(self, button: QgsPropertyOverrideButton | None, key: QgsPalLayerSettings.Property)[source]

Registers a data defined override button. Handles setting up connections for the button and initializing the button to show the correct descriptions and help text for the associated property.

Parameters:
virtual setContext(self, context: QgsSymbolWidgetContext)[source]

Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.

See also

context()

Parameters:

context (QgsSymbolWidgetContext)

setDataDefinedProperties(self, dataDefinedProperties: QgsPropertyCollection)[source]

Sets the current data defined properties to show in the widget.

Parameters:

dataDefinedProperties (QgsPropertyCollection)

virtual setGeometryType(self, type: Qgis.GeometryType)[source]

Sets the geometry type of the features to customize the widget accordingly.

Parameters:

type (Qgis.GeometryType)

virtual updateDataDefinedProperties(self, properties: QgsPropertyCollection)[source]

Updates a data defined properties collection, correctly setting the values for any properties related to this widget.

Parameters:

properties (QgsPropertyCollection)