QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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
18#include <QDomText>
19
27
29{
30 return mText;
31}
32
34{
35 mText = text;
36}
37
38void QgsAttributeEditorTextElement::saveConfiguration( QDomElement &elem, QDomDocument &doc ) const
39{
40 const QDomText textElem = doc.createTextNode( mText );
41 elem.appendChild( textElem );
42}
43
44void QgsAttributeEditorTextElement::loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields )
45{
46 Q_UNUSED( layerId )
47 Q_UNUSED( context )
48 Q_UNUSED( fields )
49 setText( element.text() );
50}
51
52QString QgsAttributeEditorTextElement::typeIdentifier() const
53{
54 return QStringLiteral( "attributeEditorTextElement" );
55}
56
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
QgsAttributeEditorElement(Qgis::AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
Constructor.
QString name() const
Returns the name of this element.
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:46
A container for the context for various read/write operations on objects.