Class: QgsAttributeEditorContainer¶
- class qgis.core.QgsAttributeEditorContainer¶
Bases:
QgsAttributeEditorElement
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.
QgsAttributeEditorContainer(name: str, parent:
QgsAttributeEditorElement
, backgroundColor: Union[QColor, Qt.GlobalColor, QGradient] = QColor()) Creates a new attribute editor container- Parameters:
name – The name to show as title
parent – The parent. May be another container.
backgroundColor – The optional background color of the container.
QgsAttributeEditorContainer(
QgsAttributeEditorContainer
)Methods
Add a child element to this container.
Returns the background color of the container.
Gets a list of the children elements of this container
Clear all children from this container.
Creates a deep copy of this element.
For group box containers returns
True
if this group box is collapsed.Gets the number of columns in this group.
Traverses the element tree to find any element of the specified type
Returns if this container is going to be a group box
Sets the background color to
backgroundColor
.For group box containers sets if this group box is
collapsed
.Set the number of columns in this group.
Determines if this container is rendered as collapsible group box or tab in a tabwidget
Change the name of this container.
Sets the container type.
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.
Returns the container type.
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 ¶
Returns the background color of the container.
See also
New in version 3.8.
- Return type:
QColor
- children(self) List[QgsAttributeEditorElement] ¶
Gets a list of the children elements of this container
- Return type:
- 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.
- Parameters:
parent (QgsAttributeEditorElement) –
- Return type:
- collapsed(self) bool ¶
For group box containers returns
True
if this group box is collapsed.- Return type:
bool
- Returns:
True
if the group box is collapsed,False
otherwise.
See also
See also
New in version 3.26.
- columnCount(self) int ¶
Gets the number of columns in this group.
See also
- Return type:
int
- findElements(self, type: Qgis.AttributeEditorType) List[QgsAttributeEditorElement] ¶
Traverses the element tree to find any element of the specified type
- Parameters:
type (Qgis.AttributeEditorType) – The type which should be searched
- Return type:
- Returns:
A list of elements of the type which has been searched for
- isGroupBox(self) bool ¶
Returns if this container is going to be a group box
- Return type:
bool
- Returns:
True
if it will be a group box,False
if it will be a tab
Deprecated since version Use:
type()
instead.
- setBackgroundColor(self, backgroundColor: QColor | Qt.GlobalColor | QGradient)¶
Sets the background color to
backgroundColor
.See also
- Parameters:
backgroundColor (Union[QColor) –
- setCollapsed(self, collapsed: bool)¶
For group box containers sets if this group box is
collapsed
.See also
See also
New in version 3.26.
- Parameters:
collapsed (bool) –
- setColumnCount(self, columnCount: int)¶
Set the number of columns in this group.
See also
- 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
Deprecated since version use:
setType()
instead.
- setName(self, name: str)¶
Change the name of this container.
- Parameters:
name (str) –
- setType(self, type: Qgis.AttributeEditorContainerType)¶
Sets the container type.
See also
New in version 3.32.
- Parameters:
type (Qgis.AttributeEditorContainerType) –
- 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.
- Parameters:
visibilityExpression (QgsOptionalExpression) –
- type(self) Qgis.AttributeEditorContainerType ¶
Returns the container type.
See also
New in version 3.32.
- Return type:
- 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.
- Return type: