Class: QgsAttributeEditorContext

class qgis.gui.QgsAttributeEditorContext

Bases: sip.wrapper

This class contains context information for attribute editor widgets. It will be passed to embedded widgets whenever this occurs (e.g. when showing an embedded form due to relations)

QgsAttributeEditorContext() Constructor for QgsAttributeEditorContext

QgsAttributeEditorContext(parentContext: QgsAttributeEditorContext, formMode: QgsAttributeEditorContext.FormMode)

QgsAttributeEditorContext(parentContext: QgsAttributeEditorContext, relation: QgsRelation, relationMode: QgsAttributeEditorContext.RelationMode, widgetMode: QgsAttributeEditorContext.FormMode)

QgsAttributeEditorContext(a0: QgsAttributeEditorContext)

Methods

allowCustomUi

Returns True if the attribute editor should permit use of custom UI forms.

attributeFormMode

Returns current attributeFormMode

attributeFormModeString

Returns given attributeFormMode as string

cadDockWidget

Returns the associated CAD dock widget (e.g. to be used in map tools).

distanceArea

Returns the distance area object used for area/length calculations.

formFeature

Returns current feature from the currently edited form or table row

formMode

Returns the form mode.

mainMessageBar

Returns the main message bar

mapCanvas

Returns the associated map canvas (e.g. to zoom to related features).

parentContext

rtype:

Optional[QgsAttributeEditorContext]

parentFormFeature

Returns the feature of the currently edited parent form in its actual state

relation

Returns the attribute relation.

relationMode

Returns the attribute relation mode.

setAllowCustomUi

Sets whether the attribute editor should permit use of custom UI forms.

setAttributeFormMode

Set attributeFormMode for the edited form

setCadDockWidget

Sets the associated CAD dock widget, cadDockWidget, (e.g. to be used in map tools).

setDistanceArea

Sets distance area object, distanceArea, for area/length calculations

setFormFeature

Set current feature for the currently edited form or table row

setFormMode

Sets the form mode.

setMainMessageBar

Set current messageBar as the main message bar

setMapCanvas

Sets the associated map canvas, mapCanvas, (e.g. to zoom to related features).

setParentFormFeature

Sets the feature of the currently edited parent form

setRelation

Set attribute relation and mode

setVectorLayerTools

Sets the associated vector layer tools.

vectorLayerTools

Returns the associated vector layer tools.

Attributes

AddFeatureMode

AggregateSearchMode

Embed

FixAttributeMode

IdentifyMode

MultiEditMode

Multiple

Popup

SearchMode

Single

SingleEditMode

StandaloneDialog

Undefined

staticMetaObject

AddFeatureMode = 1
AggregateSearchMode = 5
Embed = 0
FixAttributeMode = 2
class FormMode

Bases: int

IdentifyMode = 6
class Mode

Bases: int

baseClass

alias of QgsAttributeEditorContext

MultiEditMode = 3
Multiple = 1
Popup = 2
class RelationMode

Bases: int

SearchMode = 4
Single = 2
SingleEditMode = 0
StandaloneDialog = 1
Undefined = 0
allowCustomUi(self) bool

Returns True if the attribute editor should permit use of custom UI forms.

Return type:

bool

attributeFormMode(self) QgsAttributeEditorContext.Mode

Returns current attributeFormMode

Added in version 3.4.

Return type:

QgsAttributeEditorContext.Mode

attributeFormModeString(self) str

Returns given attributeFormMode as string

Added in version 3.4.

Return type:

str

cadDockWidget(self) QgsAdvancedDigitizingDockWidget | None

Returns the associated CAD dock widget (e.g. to be used in map tools).

Note

Unstable API. This method is unstable API and may be modified or removed at any time.

Added in version 3.10.

Return type:

Optional[QgsAdvancedDigitizingDockWidget]

distanceArea(self) QgsDistanceArea

Returns the distance area object used for area/length calculations.

Return type:

QgsDistanceArea

formFeature(self) QgsFeature

Returns current feature from the currently edited form or table row

See also

setFormFeature()

Added in version 3.2.

Return type:

QgsFeature

formMode(self) QgsAttributeEditorContext.FormMode

Returns the form mode.

See also

setFormMode()

Return type:

QgsAttributeEditorContext.FormMode

mainMessageBar(self) QgsMessageBar | None

Returns the main message bar

Added in version 3.12.

Return type:

Optional[QgsMessageBar]

mapCanvas(self) QgsMapCanvas | None

Returns the associated map canvas (e.g. to zoom to related features).

See also

setMapCanvas()

Added in version 3.2.

Return type:

Optional[QgsMapCanvas]

parentContext(self) QgsAttributeEditorContext | None
Return type:

Optional[QgsAttributeEditorContext]

parentFormFeature(self) QgsFeature

Returns the feature of the currently edited parent form in its actual state

Added in version 3.14.

Return type:

QgsFeature

relation(self) QgsRelation

Returns the attribute relation.

See also

setRelation()

See also

relationMode()

Return type:

QgsRelation

relationMode(self) QgsAttributeEditorContext.RelationMode

Returns the attribute relation mode.

See also

setRelation()

See also

relation()

Return type:

QgsAttributeEditorContext.RelationMode

setAllowCustomUi(self, allow: bool)

Sets whether the attribute editor should permit use of custom UI forms.

Parameters:

allow (bool) – set to True to allow custom UI forms, or False to disable them and use default generated QGIS forms

See also

allowCustomUi()

setAttributeFormMode(self, attributeFormMode: QgsAttributeEditorContext.Mode)

Set attributeFormMode for the edited form

Added in version 3.4.

Parameters:

attributeFormMode (QgsAttributeEditorContext.Mode)

setCadDockWidget(self, cadDockWidget: QgsAdvancedDigitizingDockWidget | None)

Sets the associated CAD dock widget, cadDockWidget, (e.g. to be used in map tools).

Note

Unstable API. This method is unstable API and may be modified or removed at any time.

See also

cadDockWidget()

Added in version 3.10.

Parameters:

cadDockWidget (Optional[QgsAdvancedDigitizingDockWidget])

setDistanceArea(self, distanceArea: QgsDistanceArea)

Sets distance area object, distanceArea, for area/length calculations

See also

distanceArea()

Parameters:

distanceArea (QgsDistanceArea)

setFormFeature(self, feature: QgsFeature)

Set current feature for the currently edited form or table row

See also

formFeature()

Added in version 3.2.

Parameters:

feature (QgsFeature)

setFormMode(self, mode: QgsAttributeEditorContext.FormMode)

Sets the form mode.

Parameters:

mode (QgsAttributeEditorContext.FormMode) – form mode

See also

formMode()

setMainMessageBar(self, messageBar: QgsMessageBar | None)

Set current messageBar as the main message bar

Added in version 3.12.

Parameters:

messageBar (Optional[QgsMessageBar])

setMapCanvas(self, mapCanvas: QgsMapCanvas | None)

Sets the associated map canvas, mapCanvas, (e.g. to zoom to related features).

See also

mapCanvas()

Added in version 3.2.

Parameters:

mapCanvas (Optional[QgsMapCanvas])

setParentFormFeature(self, feature: QgsFeature)

Sets the feature of the currently edited parent form

Added in version 3.14.

Parameters:

feature (QgsFeature)

setRelation(self, relation: QgsRelation, mode: QgsAttributeEditorContext.RelationMode)

Set attribute relation and mode

Parameters:

See also

relation()

See also

relationMode()

setVectorLayerTools(self, vlTools: QgsVectorLayerTools | None)

Sets the associated vector layer tools.

Parameters:

vlTools (Optional[QgsVectorLayerTools]) – vector layer tools

staticMetaObject = <PyQt5.QtCore.QMetaObject object>
vectorLayerTools(self) QgsVectorLayerTools | None

Returns the associated vector layer tools.

Return type:

Optional[QgsVectorLayerTools]