QgsAttributeEditorElement class
This is an abstract base class for any elements of a drag and drop form.
Contents
This can either be a container which will be represented on the screen as a tab widget or ca 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.
Derived classes
- class 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.
- class QgsAttributeEditorField
- This element will load a field's widget onto the form.
- class QgsAttributeEditorQmlElement
- An attribute editor widget that will represent arbitrary QML code.
- class QgsAttributeEditorRelation
- This element will load a relation editor onto the form.
Public types
Constructors, destructors, conversion operators
- QgsAttributeEditorElement(AttributeEditorType type, const QString& name, QgsAttributeEditorElement* parent = nullptr)
- Constructor.
Public functions
- auto clone(QgsAttributeEditorElement* parent) const -> QgsAttributeEditorElement* pure virtual
- Returns a clone of this element.
- auto name() const -> QString
- Returns the name of this element.
- auto parent() const -> QgsAttributeEditorElement*
- Gets the parent of this element.
- void setShowLabel(bool showLabel)
- Controls if this element should be labeled with a title (field, relation or groupname).
- auto showLabel() const -> bool
- Controls if this element should be labeled with a title (field, relation or groupname).
- auto toDomElement(QDomDocument& doc) const -> QDomElement
- Gets the XML Dom element to save this element.
- auto type() const -> AttributeEditorType
- The type of this element.
Private functions
- void saveConfiguration(QDomElement& elem) const pure virtual
- Should be implemented by subclasses to save type specific configuration.
- auto typeIdentifier() const -> QString pure virtual
- All subclasses need to overwrite this method and return a type specific identifier.
Enum documentation
enum QgsAttributeEditorElement:: AttributeEditorType
| Enumerators | |
|---|---|
| AeTypeContainer |
A container. |
| AeTypeField |
A field. |
| AeTypeRelation |
A relation. |
| AeTypeInvalid |
Invalid. |
| AeTypeQmlElement |
A QML element. |
Function documentation
QgsAttributeEditorElement:: QgsAttributeEditorElement(AttributeEditorType type,
const QString& name,
QgsAttributeEditorElement* parent = nullptr)
Constructor.
| Parameters | |
|---|---|
| type | The type of the new element. Should never |
| name | |
| parent | |
QgsAttributeEditorElement* QgsAttributeEditorElement:: clone(QgsAttributeEditorElement* parent) const pure virtual
Returns a clone of this element.
To be implemented by subclasses.
QString QgsAttributeEditorElement:: name() const
Returns the name of this element.
| Returns | The name for this element |
|---|
QgsAttributeEditorElement* QgsAttributeEditorElement:: parent() const
Gets the parent of this element.
void QgsAttributeEditorElement:: setShowLabel(bool showLabel)
Controls if this element should be labeled with a title (field, relation or groupname).
bool QgsAttributeEditorElement:: showLabel() const
Controls if this element should be labeled with a title (field, relation or groupname).
QDomElement QgsAttributeEditorElement:: toDomElement(QDomDocument& doc) const
Gets the XML Dom element to save this element.
| Parameters | |
|---|---|
| doc | The QDomDocument which is used to create new XML elements |
| Returns | A DOM element to serialize this element |
AttributeEditorType QgsAttributeEditorElement:: type() const
The type of this element.
| Returns | The type |
|---|
void QgsAttributeEditorElement:: saveConfiguration(QDomElement& elem) const pure virtual private
Should be implemented by subclasses to save type specific configuration.
QString QgsAttributeEditorElement:: typeIdentifier() const pure virtual private
All subclasses need to overwrite this method and return a type specific identifier.
Needs to be XML key compatible.