Class: QgsCalloutWidget

Base class for widgets which allow control over the properties of callouts.

Added in version 3.10.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: callout(), setCallout(), setGeometryType()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsCalloutWidget

Base classes

QWidget

QObject

QPaintDevice

Abstract Methods

callout

Returns the callout defined by the current settings in the widget.

setCallout

Sets the callout to show in the widget.

setGeometryType

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

Methods

context

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

layer

Returns the vector layer associated with the widget.

registerDataDefinedButton

Registers a data defined override button.

vectorLayer

Returns the vector layer associated with the widget.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsCalloutWidget. 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.

Signals

changed

Should be emitted whenever configuration changes happened on this symbol layer configuration.

class qgis.gui.QgsCalloutWidget[source]

Bases: QWidget

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

Constructor for QgsCalloutWidget.

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

  • parent (Optional[QWidget]) – parent widget

abstract callout(self) QgsCallout | None[source]

Returns the callout defined by the current settings in the widget. Ownership is not transferred, and the caller should clone the returned value.

See also

setCallout()

Return type:

Optional[QgsCallout]

signal changed[source]

Should be emitted whenever configuration changes happened on this symbol layer configuration. If the subsymbol is changed, symbolChanged() should be emitted instead.

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

layer(self) QgsMapLayer | None[source]

Returns the vector layer associated with the widget.

Added in version 3.40.

Return type:

Optional[QgsMapLayer]

registerDataDefinedButton(self, button: QgsPropertyOverrideButton | None, key: QgsCallout.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:
abstract setCallout(self, callout: QgsCallout | None)[source]

Sets the callout to show in the widget. Ownership is not transferred.

See also

callout()

Parameters:

callout (Optional[QgsCallout])

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.

Parameters:

context (QgsSymbolWidgetContext) – symbol widget context

See also

context()

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

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

Parameters:

type (Qgis.GeometryType)

vectorLayer(self) QgsVectorLayer | None[source]

Returns the vector layer associated with the widget.

Deprecated since version 3.40: Use layer() instead.

Return type:

Optional[QgsVectorLayer]