QgsAttributeEditorContainer class
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.
Contents
Base classes
- class QgsAttributeEditorElement
- This is an abstract base class for any elements of a drag and drop form.
Constructors, destructors, conversion operators
- QgsAttributeEditorContainer(const QString& name, QgsAttributeEditorElement* parent)
- Creates a new attribute editor container.
Public functions
- void addChildElement(QgsAttributeEditorElement* element) virtual
- Add a child element to this container.
- auto children() const -> QList<QgsAttributeEditorElement*>
- Gets a list of the children elements of this container.
- void clear()
- Clear all children from this container.
- auto clone(QgsAttributeEditorElement* parent) const -> QgsAttributeEditorElement* override
- Creates a deep copy of this element.
- auto columnCount() const -> int
- Gets the number of columns in this group.
- auto findElements(AttributeEditorType type) const -> QList<QgsAttributeEditorElement*> virtual
- Traverses the element tree to find any element of the specified type.
- auto isGroupBox() const -> bool virtual
- Returns if this container is going to be rendered as a group box.
- void setColumnCount(int columnCount)
- Set the number of columns in this group.
- void setIsGroupBox(bool isGroupBox) virtual
- Determines if this container is rendered as collapsible group box or tab in a tabwidget.
- void setName(const QString& name)
- Change the name of this container.
- void setVisibilityExpression(const QgsOptionalExpression& 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.
- auto visibilityExpression() const -> 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.
Private functions
- void saveConfiguration(QDomElement& elem) const override
- Should be implemented by subclasses to save type specific configuration.
- auto typeIdentifier() const -> QString override
- All subclasses need to overwrite this method and return a type specific identifier.
Function documentation
QgsAttributeEditorContainer:: QgsAttributeEditorContainer(const QString& name,
QgsAttributeEditorElement* parent)
Creates a new attribute editor container.
| Parameters | |
|---|---|
| name | The name to show as title |
| parent | The parent. May be another container. |
void QgsAttributeEditorContainer:: addChildElement(QgsAttributeEditorElement* element) virtual
Add a child element to this container.
| Parameters | |
|---|---|
| element | The element to add as child |
This may be another container, a field or a relation.
QList<QgsAttributeEditorElement*> QgsAttributeEditorContainer:: children() const
Gets a list of the children elements of this container.
| Returns | A list of elements |
|---|
QgsAttributeEditorElement* QgsAttributeEditorContainer:: clone(QgsAttributeEditorElement* parent) const override
Creates a deep copy of this element.
To be implemented by subclasses.
QList<QgsAttributeEditorElement*> QgsAttributeEditorContainer:: findElements(AttributeEditorType type) const virtual
Traverses the element tree to find any element of the specified type.
| Parameters | |
|---|---|
| type | The type which should be searched |
| Returns | A list of elements of the type which has been searched for |
bool QgsAttributeEditorContainer:: isGroupBox() const virtual
Returns if this container is going to be rendered as a group box.
| Returns | True if it will be a group box, false if it will be a tab |
|---|
void QgsAttributeEditorContainer:: setIsGroupBox(bool isGroupBox) virtual
Determines if this container is rendered as collapsible group box or tab in a tabwidget.
| Parameters | |
|---|---|
| isGroupBox | If true, this will be a group box |
void QgsAttributeEditorContainer:: setVisibilityExpression(const QgsOptionalExpression& 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.
QgsOptionalExpression QgsAttributeEditorContainer:: visibilityExpression() const
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.
void QgsAttributeEditorContainer:: saveConfiguration(QDomElement& elem) const override private
Should be implemented by subclasses to save type specific configuration.
QString QgsAttributeEditorContainer:: typeIdentifier() const override private
All subclasses need to overwrite this method and return a type specific identifier.
Needs to be XML key compatible.