21 mChildren.append( widget );
31 return mVisibilityExpression;
36 if ( visibilityExpression == mVisibilityExpression )
44 return mBackgroundColor;
54 QList<QgsAttributeEditorElement *> results;
56 const auto constMChildren = mChildren;
59 if ( elem->type() ==
type )
61 results.append( elem );
77 qDeleteAll( mChildren );
90 mRelation = relationManager->
relation( mRelationId );
97 element->mRelation = mRelation;
98 element->mShowLinkButton = mShowLinkButton;
99 element->mShowUnlinkButton = mShowUnlinkButton;
103 void QgsAttributeEditorField::saveConfiguration( QDomElement &elem )
const 105 elem.setAttribute( QStringLiteral(
"index" ), mIdx );
108 QString QgsAttributeEditorField::typeIdentifier()
const 110 return QStringLiteral(
"attributeEditorField" );
115 QDomElement elem = doc.createElement( typeIdentifier() );
116 elem.setAttribute( QStringLiteral(
"name" ),
mName );
117 elem.setAttribute( QStringLiteral(
"showLabel" ),
mShowLabel );
119 saveConfiguration( elem );
133 void QgsAttributeEditorRelation::saveConfiguration( QDomElement &elem )
const 135 elem.setAttribute( QStringLiteral(
"relation" ), mRelation.id() );
136 elem.setAttribute( QStringLiteral(
"showLinkButton" ), mShowLinkButton );
137 elem.setAttribute( QStringLiteral(
"showUnlinkButton" ), mShowUnlinkButton );
140 QString QgsAttributeEditorRelation::typeIdentifier()
const 142 return QStringLiteral(
"attributeEditorRelation" );
147 return mShowLinkButton;
152 mShowLinkButton = showLinkButton;
157 return mShowUnlinkButton;
162 mShowUnlinkButton = showUnlinkButton;
183 void QgsAttributeEditorQmlElement::saveConfiguration( QDomElement &elem )
const 185 QDomText codeElem = elem.ownerDocument().createTextNode( mQmlCode );
186 elem.appendChild( codeElem );
189 QString QgsAttributeEditorQmlElement::typeIdentifier()
const 191 return QStringLiteral(
"attributeEditorQmlElement" );
209 mHtmlCode = htmlCode;
212 void QgsAttributeEditorHtmlElement::saveConfiguration( QDomElement &elem )
const 214 QDomText codeElem = elem.ownerDocument().createTextNode( mHtmlCode );
215 elem.appendChild( codeElem );
218 QString QgsAttributeEditorHtmlElement::typeIdentifier()
const 220 return QStringLiteral(
"attributeEditorHtmlElement" );
void clear()
Clear all children from this container.
An attribute editor widget that will represent arbitrary QML code.
bool init(QgsRelationManager *relManager)
Initializes the relation from the id.
void setName(const QString &name)
Change the name of this container.
This is an abstract base class for any elements of a drag and drop form.
void setVisibilityExpression(const QgsOptionalExpression &visibilityExpression)
The visibility expression is used in the attribute form to show or hide this container based on an ex...
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
virtual QList< QgsAttributeEditorElement * > findElements(AttributeEditorType type) const
Traverses the element tree to find any element of the specified type.
This element will load a field's widget onto the form.
QDomElement toDomElement(QDomDocument &doc) const
Gets the XML Dom element to save this element.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
This element will load a relation editor onto the form.
An attribute editor widget that will represent arbitrary HTML code.
AttributeEditorType type() const
The type of this element.
void setBackgroundColor(const QColor &backgroundColor)
Sets the background color to backgroundColor.
void setQmlCode(const QString &qmlCode)
Sets the QML code that will be represented within this widget to qmlCode.
An expression with an additional enabled flag.
void setShowLabel(bool showLabel)
Controls if this element should be labeled with a title (field, relation or groupname).
bool showUnlinkButton() const
Determines if the "unlink feature" button should be shown.
bool showLabel() const
Controls if this element should be labeled with a title (field, relation or groupname).
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
QgsOptionalExpression visibilityExpression() const
The visibility expression is used in the attribute form to show or hide this container based on an ex...
QString qmlCode() const
The QML code that will be represented within this widget.
QString htmlCode() const
The QML code that will be represented within this widget.
void setShowLinkButton(bool showLinkButton)
Determines if the "link feature" button should be shown.
void setShowUnlinkButton(bool showUnlinkButton)
Determines if the "unlink feature" button should be shown.
QColor backgroundColor() const
backgroundColor
void setHtmlCode(const QString &htmlCode)
Sets the HTML code that will be represented within this widget to htmlCode.
This class manages a set of relations between layers.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
This is a container for attribute editors, used to group them visually in the attribute form if it is...
virtual void addChildElement(QgsAttributeEditorElement *element)
Add a child element to this container.
bool showLinkButton() const
Determines if the "link feature" button should be shown.
Q_INVOKABLE QgsRelation relation(const QString &id) const
Gets access to a relation by its id.
QString name() const
Returns the name of this element.