Class: QgsAttributeEditorElement¶
This is an abstract base class for any elements of a drag and drop form.
This can either be a container which will be represented on the screen
as a tab widget or a collapsible group box. Or it can be a field which
will then be represented based on the QgsEditorWidget type
and configuration. Or it can be a relation and embed the form of several
children of another layer.
Class Hierarchy¶
Subclasses¶
This element will load a layer action onto the form.  | 
|
This is a container for attribute editors, used to group them visually in the attribute form if it is set to the drag and drop designer.  | 
|
This element will load a field’s widget onto the form.  | 
|
An attribute editor widget that will represent arbitrary HTML code.  | 
|
An attribute editor widget that will represent arbitrary QML code.  | 
|
This element will load a relation editor onto the form.  | 
|
An attribute editor widget that will represent a spacer.  | 
|
An attribute editor widget that will represent arbitrary text code.  | 
Enums
Attribute editor types.  | 
Methods
Returns a clone of this element.  | 
|
Returns the horizontal stretch factor for the element.  | 
|
Returns the label style.  | 
|
Returns the name of this element  | 
|
Gets the parent of this element.  | 
|
Sets the horizontal stretch factor for the element.  | 
|
Sets the labelStyle.  | 
|
Controls if this element should be labeled with a title (field, relation or groupname).  | 
|
Sets the vertical stretch factor for the element.  | 
|
Controls if this element should be labeled with a title (field, relation or groupname).  | 
|
Gets the XML Dom element to save this element.  | 
|
The type of this element  | 
|
Returns the vertical stretch factor for the element.  | 
Static Methods
Constructs the editor element from the given element  | 
- class qgis.core.QgsAttributeEditorElement[source]¶
 Bases:
object- __init__(type: Qgis.AttributeEditorType, name: str | None, parent: QgsAttributeEditorElement | None = None)
 Constructor
- Parameters:
 type (Qgis.AttributeEditorType) – The type of the new element.
name (Optional[str])
parent (Optional[QgsAttributeEditorElement] = None)
- __init__(a0: QgsAttributeEditorElement)
 - Parameters:
 
- class AttributeEditorType(*values)¶
 Bases:
IntEnumAttribute editor types.
Note
Prior to QGIS 3.32 this was available as
QgsAttributeEditorElement.AttributeEditorType.Added in version 3.32.
Container: A containerAvailable as
QgsAttributeEditorElement.AeTypeContainerin older QGIS releases.Field: A fieldAvailable as
QgsAttributeEditorElement.AeTypeFieldin older QGIS releases.Relation: A relationAvailable as
QgsAttributeEditorElement.AeTypeRelationin older QGIS releases.QmlElement: A QML elementAvailable as
QgsAttributeEditorElement.AeTypeQmlElementin older QGIS releases.HtmlElement: A HTML elementAvailable as
QgsAttributeEditorElement.AeTypeHtmlElementin older QGIS releases.Action: A layer action elementAdded in version 3.22.
Available as
QgsAttributeEditorElement.AeTypeActionin older QGIS releases.TextElement: A text elementAdded in version 3.30.
Available as
QgsAttributeEditorElement.AeTypeTextElementin older QGIS releases.SpacerElement: A spacer elementAdded in version 3.30.
Available as
QgsAttributeEditorElement.AeTypeSpacerElementin older QGIS releases.Invalid: InvalidAvailable as
QgsAttributeEditorElement.AeTypeInvalidin older QGIS releases.
- class LabelStyle¶
 Bases:
objectThe TabStyle struct defines color and font overrides for form fields, tabs and groups labels.
Added in version 3.26.
- color¶
 Label font
- font¶
 Label font
- overrideColor¶
 Override label color
- overrideFont¶
 Override label font
- clone(self, parent: QgsAttributeEditorElement | None) QgsAttributeEditorElement | None[source]¶
 Returns a clone of this element. To be implemented by subclasses.
- Parameters:
 parent (Optional[QgsAttributeEditorElement])
- Return type:
 Optional[QgsAttributeEditorElement]
- static create(element: QDomElement, layerId: str | None, fields: QgsFields, context: QgsReadWriteContext, parent: QgsAttributeEditorElement | None = None) QgsAttributeEditorElement | None[source]¶
 Constructs the editor element from the given element
Added in version 3.18.
- Parameters:
 element (QDomElement)
layerId (Optional[str])
fields (QgsFields)
context (QgsReadWriteContext)
parent (Optional[QgsAttributeEditorElement] = None)
- Return type:
 Optional[QgsAttributeEditorElement]
- horizontalStretch(self) int[source]¶
 Returns the horizontal stretch factor for the element.
See also
See also
Added in version 3.32.
- Return type:
 int
- labelStyle(self) QgsAttributeEditorElement.LabelStyle[source]¶
 Returns the label style.
See also
Added in version 3.26.
- Return type:
 
- name(self) str[source]¶
 Returns the name of this element
- Return type:
 str
- Returns:
 The name for this element
- parent(self) QgsAttributeEditorElement | None[source]¶
 Gets the parent of this element.
- Return type:
 Optional[QgsAttributeEditorElement]
- setHorizontalStretch(self, stretch: int)[source]¶
 Sets the horizontal
stretchfactor for the element.See also
See also
Added in version 3.32.
- Parameters:
 stretch (int)
- setLabelStyle(self, labelStyle: QgsAttributeEditorElement.LabelStyle)[source]¶
 Sets the
labelStyle.See also
Added in version 3.26.
- Parameters:
 labelStyle (QgsAttributeEditorElement.LabelStyle)
- setShowLabel(self, showLabel: bool)[source]¶
 Controls if this element should be labeled with a title (field, relation or groupname).
- Parameters:
 showLabel (bool)
- setVerticalStretch(self, stretch: int)[source]¶
 Sets the vertical
stretchfactor for the element.See also
See also
Added in version 3.32.
- Parameters:
 stretch (int)
- showLabel(self) bool[source]¶
 Controls if this element should be labeled with a title (field, relation or groupname).
- Return type:
 bool
- toDomElement(self, doc: QDomDocument) QDomElement[source]¶
 Gets the XML Dom element to save this element.
- Parameters:
 doc (QDomDocument) – The QDomDocument which is used to create new XML elements
- Return type:
 QDomElement
- Returns:
 A DOM element to serialize this element
- type(self) Qgis.AttributeEditorType[source]¶
 The type of this element
- Return type:
 - Returns:
 The type