QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgsattributeeditortextelement.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributeeditortextelement.cpp - QgsAttributeEditorTextelement
3
4 ---------------------
5 begin : 28.12.2022
6 copyright : (C) 2022 by Alessandro Pasotti
7 email : elpaso at itopen dot it
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
17#include <QDomText>
18
20{
22 element->setText( mText );
23
24 return element;
25}
26
28{
29 return mText;
30}
31
32void QgsAttributeEditorTextElement::setText( const QString &text )
33{
34 mText = text;
35}
36
37void QgsAttributeEditorTextElement::saveConfiguration( QDomElement &elem, QDomDocument &doc ) const
38{
39 const QDomText textElem = doc.createTextNode( mText );
40 elem.appendChild( textElem );
41}
42
43void QgsAttributeEditorTextElement::loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields )
44{
45 Q_UNUSED( layerId )
46 Q_UNUSED( context )
47 Q_UNUSED( fields )
48 setText( element.text() );
49}
50
51QString QgsAttributeEditorTextElement::typeIdentifier() const
52{
53 return QStringLiteral( "attributeEditorTextElement" );
54}
55
This is an abstract base class for any elements of a drag and drop form.
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
QString name() const
Returns the name of this element.
An attribute editor widget that will represent arbitrary text code.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
void setText(const QString &text)
Sets the text that will be represented within this widget to text.
QString text() const
The Text that will be represented within this widget.
QgsAttributeEditorTextElement(const QString &name, QgsAttributeEditorElement *parent)
Creates a new element which can display text.
Container of fields for a vector layer.
Definition: qgsfields.h:45
The class is used as a container of context for various read/write operations on other objects.