QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
22 mChildren.append( widget );
32 return mVisibilityExpression;
45 return mBackgroundColor;
55 QList<QgsAttributeEditorElement *> results;
57 const auto constMChildren = mChildren;
60 if ( elem->type() ==
type )
62 results.append( elem );
78 qDeleteAll( mChildren );
91 mRelation = relationManager->
relation( mRelationId );
98 element->mRelation = mRelation;
99 element->mButtons = mButtons;
100 element->mForceSuppressFormPopup = mForceSuppressFormPopup;
101 element->mNmRelationId = mNmRelationId;
102 element->mLabel = mLabel;
106 void QgsAttributeEditorField::saveConfiguration( QDomElement &elem )
const
108 elem.setAttribute( QStringLiteral(
"index" ), mIdx );
111 QString QgsAttributeEditorField::typeIdentifier()
const
113 return QStringLiteral(
"attributeEditorField" );
118 QDomElement elem = doc.createElement( typeIdentifier() );
119 elem.setAttribute( QStringLiteral(
"name" ),
mName );
120 elem.setAttribute( QStringLiteral(
"showLabel" ),
mShowLabel );
121 saveConfiguration( elem );
135 void QgsAttributeEditorRelation::saveConfiguration( QDomElement &elem )
const
137 elem.setAttribute( QStringLiteral(
"relation" ), mRelation.
id() );
139 elem.setAttribute( QStringLiteral(
"forceSuppressFormPopup" ), mForceSuppressFormPopup );
140 elem.setAttribute( QStringLiteral(
"nmRelationId" ), mNmRelationId.toString() );
141 elem.setAttribute( QStringLiteral(
"label" ), mLabel );
144 QString QgsAttributeEditorRelation::typeIdentifier()
const
146 return QStringLiteral(
"attributeEditorRelation" );
151 return mButtons.testFlag( Button::Link );
161 return mButtons.testFlag( Button::Unlink );
171 mButtons.setFlag( Button::SaveChildEdits, showSaveChildEdits );
176 return mButtons.testFlag( Button::SaveChildEdits );
191 return mForceSuppressFormPopup;
201 return mNmRelationId;
232 void QgsAttributeEditorQmlElement::saveConfiguration( QDomElement &elem )
const
234 QDomText codeElem = elem.ownerDocument().createTextNode( mQmlCode );
235 elem.appendChild( codeElem );
238 QString QgsAttributeEditorQmlElement::typeIdentifier()
const
240 return QStringLiteral(
"attributeEditorQmlElement" );
261 void QgsAttributeEditorHtmlElement::saveConfiguration( QDomElement &elem )
const
263 QDomText codeElem = elem.ownerDocument().createTextNode( mHtmlCode );
264 elem.appendChild( codeElem );
267 QString QgsAttributeEditorHtmlElement::typeIdentifier()
const
269 return QStringLiteral(
"attributeEditorHtmlElement" );
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
void setVisibilityExpression(const QgsOptionalExpression &visibilityExpression)
The visibility expression is used in the attribute form to show or hide this container based on an ex...
This is an abstract base class for any elements of a drag and drop form.
QString qgsFlagValueToKeys(const T &value)
Returns the value for the given keys of a flag.
This class manages a set of relations between layers.
Q_DECL_DEPRECATED bool showLinkButton() const
Determines if the "link feature" button should be shown.
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.
void setShowLabel(bool showLabel)
Controls if this element should be labeled with a title (field, relation or groupname).
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
void setName(const QString &name)
Change the name of this container.
Q_DECL_DEPRECATED void setShowUnlinkButton(bool showUnlinkButton)
Determines if the "unlink feature" button should be shown.
Q_INVOKABLE QgsRelation relation(const QString &id) const
Gets access to a relation by its id.
void setVisibleButtons(const QgsAttributeEditorRelation::Buttons &buttons)
Defines the buttons which are shown.
QgsAttributeEditorHtmlElement(const QString &name, QgsAttributeEditorElement *parent)
Creates a new element which can display HTML.
bool init(QgsRelationManager *relManager)
Initializes the relation from the id.
Q_DECL_DEPRECATED void setShowLinkButton(bool showLinkButton)
Determines if the "link feature" button should be shown.
Q_DECL_DEPRECATED void setShowSaveChildEditsButton(bool showChildEdits)
Determines if the "Save child layer edits" button should be shown.
void setNmRelationId(const QVariant &nmRelationId=QVariant())
Sets nmRelationId for the relation id of the second relation involved in an N:M relation.
@ AeTypeContainer
A container.
An attribute editor widget that will represent arbitrary QML code.
bool showLabel() const
Controls if this element should be labeled with a title (field, relation or groupname).
QgsAttributeEditorField(const QString &name, int idx, QgsAttributeEditorElement *parent)
Creates a new attribute editor element which represents a field.
This element will load a relation editor onto the form.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
void setQmlCode(const QString &qmlCode)
Sets the QML code that will be represented within this widget to qmlCode.
QString qmlCode() const
The QML code that will be represented within this widget.
Q_DECL_DEPRECATED bool showUnlinkButton() const
Determines if the "unlink feature" button should be shown.
QString label() const
Determines the label of this element.
void setHtmlCode(const QString &htmlCode)
Sets the HTML code that will be represented within this widget to htmlCode.
bool forceSuppressFormPopup() const
Determines the force suppress form popup status.
An expression with an additional enabled flag.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
QVariant nmRelationId() const
Determines the relation id of the second relation involved in an N:M relation.
Q_DECL_DEPRECATED QgsAttributeEditorRelation(const QString &name, const QString &relationId, QgsAttributeEditorElement *parent)
QString htmlCode() const
The QML code that will be represented within this widget.
void setBackgroundColor(const QColor &backgroundColor)
Sets the background color to backgroundColor.
void setForceSuppressFormPopup(bool forceSuppressFormPopup)
Sets force suppress form popup status to forceSuppressFormPopup.
void clear()
Clear all children from this container.
QgsAttributeEditorQmlElement(const QString &name, QgsAttributeEditorElement *parent)
Creates a new element which can display QML.
This is a container for attribute editors, used to group them visually in the attribute form if it is...
Q_DECL_DEPRECATED bool showSaveChildEditsButton() const
Determines if the "Save child layer edits" button should be shown.
AttributeEditorType type() const
The type 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 name() const
Returns the name of this element.
void setLabel(const QString &label=QString())
Sets label for this element If it's empty it takes the relation id as label.
QDomElement toDomElement(QDomDocument &doc) const
Gets the XML Dom element to save this element.
virtual void addChildElement(QgsAttributeEditorElement *element)
Add a child element to this container.
An attribute editor widget that will represent arbitrary HTML code.
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
QColor backgroundColor() const
backgroundColor