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

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]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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]