QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
30 QDomElement elem = doc.createElement( typeIdentifier() );
31 elem.setAttribute( QStringLiteral(
"name" ),
mName );
32 elem.setAttribute( QStringLiteral(
"showLabel" ),
mShowLabel );
34 saveConfiguration( elem, doc );
62 const QString
name = element.attribute( QStringLiteral(
"name" ) );
64 if ( element.tagName() == QLatin1String(
"attributeEditorContainer" ) )
69 else if ( element.tagName() == QLatin1String(
"attributeEditorField" ) )
74 else if ( element.tagName() == QLatin1String(
"attributeEditorRelation" ) )
80 else if ( element.tagName() == QLatin1String(
"attributeEditorQmlElement" ) )
84 else if ( element.tagName() == QLatin1String(
"attributeEditorHtmlElement" ) )
88 else if ( element.tagName() == QLatin1String(
"attributeEditorAction" ) )
95 if ( element.hasAttribute( QStringLiteral(
"showLabel" ) ) )
96 newElement->
setShowLabel( element.attribute( QStringLiteral(
"showLabel" ) ).toInt() );
105 newElement->loadConfiguration( element, layerId, context, fields );
114 QDomElement element { node.firstChildElement( QStringLiteral(
"labelStyle" ) ) };
116 if ( ! element.isNull() )
120 if ( element.hasAttribute( QStringLiteral(
"labelColor" ) ) )
130 if ( element.hasAttribute( QStringLiteral(
"overrideLabelColor" ) ) )
132 overrideColor = element.attribute( QStringLiteral(
"overrideLabelColor" ) ) == QChar(
'1' );
135 if ( element.hasAttribute( QStringLiteral(
"overrideLabelFont" ) ) )
137 overrideFont = element.attribute( QStringLiteral(
"overrideLabelFont" ) ) == QChar(
'1' );
144 QDomElement elem { document.createElement( QStringLiteral(
"labelStyle" ) ) };
147 elem.setAttribute( QStringLiteral(
"overrideLabelColor" ), overrideColor ? QChar(
'1' ) : QChar(
'0' ) );
148 elem.setAttribute( QStringLiteral(
"overrideLabelFont" ), overrideFont ? QChar(
'1' ) : QChar(
'0' ) );
This is an abstract base class for any elements of a drag and drop form.
static QString encodeColor(const QColor &color)
LabelStyle labelStyle() const
Returns the label style.
bool operator==(LabelStyle const &other) const
Returns true if the style is equal to other.
void readXml(const QDomNode &node)
Reads configuration from node.
static QgsAttributeEditorElement * create(const QDomElement &element, const QString &layerId, const QgsFields &fields, const QgsReadWriteContext &context, QgsAttributeEditorElement *parent=nullptr)
Constructs the editor element from the given element.
The class is used as a container of context for various read/write operations on other objects.
This element will load a field's widget onto the form.
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.
void setShowLabel(bool showLabel)
Controls if this element should be labeled with a title (field, relation or groupname).
Container of fields for a vector layer.
QDomElement writeXml(QDomDocument &document) const
Creates the XML configuration from document.
static QColor decodeColor(const QString &str)
const QgsProjectTranslator * projectTranslator() const
Returns the project translator.
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).
bool overrideColor
Override label color.
This element will load a relation editor onto the form.
This element will load a layer action onto the form.
bool overrideFont
Override label font.
static bool setFromXmlChildNode(QFont &font, const QDomElement &element, const QString &childNode)
Sets the properties of a font to match the properties stored in an XML child node.
static QDomElement toXmlElement(const QFont &font, QDomDocument &document, const QString &elementName)
Returns a DOM element containing the properties of the font.
This is a container for attribute editors, used to group them visually in the attribute form if it is...
QString name() const
Returns the name of this element.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
QDomElement toDomElement(QDomDocument &doc) const
Gets the XML Dom element to save this element.
void setLabelStyle(const LabelStyle &labelStyle)
Sets the labelStyle.
virtual QString translate(const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const =0
The derived translate() translates with QTranslator and qm file the sourceText.
An attribute editor widget that will represent arbitrary HTML code.
QgsAttributeEditorElement * parent() const
Gets the parent of this element.