Class: QgsAttributeEditorContainer

class qgis.core.QgsAttributeEditorContainer(name: str, parent: QgsAttributeEditorElement, backgroundColor: Union[QColor, Qt.GlobalColor, QGradient] = QColor())

Bases: QgsAttributeEditorElement

Creates a new attribute editor container

Parameters
  • name (str) – The name to show as title

  • parent (QgsAttributeEditorElement) – The parent. May be another container.

  • backgroundColor (Union[QColor) – The optional background color of the container.

QgsAttributeEditorContainer(QgsAttributeEditorContainer)

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.

Methods

addChildElement

Add a child element to this container.

backgroundColor

backgroundColor

children

Gets a list of the children elements of this container

clear

Clear all children from this container.

clone

Creates a deep copy of this element.

columnCount

Gets the number of columns in this group

findElements

Traverses the element tree to find any element of the specified type

isGroupBox

Returns if this container is going to be rendered as a group box

setBackgroundColor

Sets the background color to backgroundColor

setColumnCount

Set the number of columns in this group

setIsGroupBox

Determines if this container is rendered as collapsible group box or tab in a tabwidget

setName

Change the name of this container

setVisibilityExpression

The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.

visibilityExpression

The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.

addChildElement(self, element: QgsAttributeEditorElement)

Add a child element to this container. This may be another container, a field or a relation.

Parameters

element (QgsAttributeEditorElement) – The element to add as child

backgroundColor(self) → QColor

backgroundColor

Return type

QColor

Returns

background color of the container

New in version 3.8.

children(self) → List[QgsAttributeEditorElement]

Gets a list of the children elements of this container

Return type

List[QgsAttributeEditorElement]

Returns

A list of elements

clear(self)

Clear all children from this container.

clone(self, parent: QgsAttributeEditorElement) → QgsAttributeEditorElement

Creates a deep copy of this element. To be implemented by subclasses.

New in version 3.0.

Parameters

parent (QgsAttributeEditorElement) –

Return type

QgsAttributeEditorElement

columnCount(self) → int

Gets the number of columns in this group

Return type

int

findElements(self, type: QgsAttributeEditorElement.AttributeEditorType) → List[QgsAttributeEditorElement]

Traverses the element tree to find any element of the specified type

Parameters

type (QgsAttributeEditorElement.AttributeEditorType) – The type which should be searched

Return type

List[QgsAttributeEditorElement]

Returns

A list of elements of the type which has been searched for

isGroupBox(self) → bool

Returns if this container is going to be rendered as a group box

Return type

bool

Returns

True if it will be a group box, False if it will be a tab

setBackgroundColor(self, backgroundColor: Union[QColor, Qt.GlobalColor, QGradient])

Sets the background color to backgroundColor

Parameters

backgroundColor (Union[QColor) –

setColumnCount(self, columnCount: int)

Set the number of columns in this group

Parameters

columnCount (int) –

setIsGroupBox(self, isGroupBox: bool)

Determines if this container is rendered as collapsible group box or tab in a tabwidget

Parameters

isGroupBox (bool) – If True, this will be a group box

setName(self, name: str)

Change the name of this container

Parameters

name (str) –

setVisibilityExpression(self, visibilityExpression: QgsOptionalExpression)

The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.

New in version 3.0.

Parameters

visibilityExpression (QgsOptionalExpression) –

visibilityExpression(self) → QgsOptionalExpression

The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.

New in version 3.0.

Return type

QgsOptionalExpression