Class: QgsAttributeDialog

An attribute table dialog for a vector layer.

QgsAttributeDialog in QgsAttributeEditorContext.Mode.SingleEditMode

QgsAttributeDialog in QgsAttributeEditorContext.Mode.SingleEditMode

Class Hierarchy

Inheritance diagram of qgis.gui.QgsAttributeDialog

Base classes

QDialog

QWidget

QObject

QPaintDevice

QgsMapLayerActionContextGenerator

An interface for objects which can create a QgsMapLayerActionContext.

Methods

attributeForm

editable

Is this dialog editable?

feature

setEditCommandMessage

Sets the edit command message (Undo) that will be used when the dialog is accepted

setExtraContextScope

Sets extraScope as an additional expression context scope to be used for calculations in this form.

setHighlight

setHighlight

setMode

Toggles the form mode.

show

Show the dialog non-blocking.

Virtual Methods

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

event

Intercept window activate/deactivate events to show/hide the highlighted feature.

class qgis.gui.QgsAttributeDialog[source]

Bases: QDialog, QgsMapLayerActionContextGenerator

__init__(vl: QgsVectorLayer | None, thepFeature: QgsFeature | None, featureOwner: bool, parent: QWidget | None = None, showDialogButtons: bool = True, context: QgsAttributeEditorContext = QgsAttributeEditorContext())

Create an attribute dialog for a given layer and feature

Parameters:
  • vl (Optional[QgsVectorLayer]) – The layer for which the dialog will be generated

  • thepFeature (Optional[QgsFeature]) – A feature for which the dialog will be generated

  • featureOwner (bool) – Set to True, if the dialog should take ownership of the feature

  • parent (Optional[QWidget] = None) – A parent widget for the dialog

  • showDialogButtons (bool = True) – True: Show the dialog buttons accept/cancel

  • context (QgsAttributeEditorContext = QgsAttributeEditorContext()) – The context in which this dialog is created

attributeForm(self) QgsAttributeForm | None[source]
Return type:

Optional[QgsAttributeForm]

editable(self) bool[source]

Is this dialog editable?

Return type:

bool

Returns:

returns True, if this dialog was created in an editable manner.

virtual event(self, e: QEvent | None) bool[source]

Intercept window activate/deactivate events to show/hide the highlighted feature.

Parameters:

e (Optional[QEvent]) – The event

Return type:

bool

Returns:

The same as the parent QDialog

feature(self) QgsFeature | None[source]
Return type:

Optional[QgsFeature]

setEditCommandMessage(self, message: str | None)[source]

Sets the edit command message (Undo) that will be used when the dialog is accepted

Parameters:

message (Optional[str]) – The message

setExtraContextScope(self, extraScope: QgsExpressionContextScope | None)[source]

Sets extraScope as an additional expression context scope to be used for calculations in this form.

Added in version 3.16.

Parameters:

extraScope (Optional[QgsExpressionContextScope])

setHighlight(self, h: QgsHighlight | None)[source]
setHighlight(None) None
Parameters:

h (Optional[QgsHighlight]) – The highlight. Ownership is taken.

setMode(self, mode: QgsAttributeEditorContext.Mode)[source]

Toggles the form mode.

Parameters:

mode (QgsAttributeEditorContext.Mode) – form mode. For example, if set to QgsAttributeEditorContext.AddFeatureMode, the dialog will be editable even with an invalid feature and will add a new feature when the form is accepted.

show(self)[source]

Show the dialog non-blocking. Reparents this dialog to be a child of the dialog form