QGIS API Documentation 3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
qgsattributeeditorhtmlelement.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributeeditorhtmlelement.cpp - QgsAttributeEditorHtmlelement
3
4 ---------------------
5 begin : 12.01.2021
6 copyright : (C) 2021 by Denis Rouzaud
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#include <QString>
20
21using namespace Qt::StringLiterals;
22
30
32{
33 return mHtmlCode;
34}
35
37{
38 mHtmlCode = htmlCode;
39}
40
41void QgsAttributeEditorHtmlElement::saveConfiguration( QDomElement &elem, QDomDocument &doc ) const
42{
43 const QDomText codeElem = doc.createTextNode( mHtmlCode );
44 elem.appendChild( codeElem );
45}
46
47void QgsAttributeEditorHtmlElement::loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields )
48{
49 Q_UNUSED( layerId )
50 Q_UNUSED( context )
51 Q_UNUSED( fields )
52 setHtmlCode( element.text() );
53}
54
55QString QgsAttributeEditorHtmlElement::typeIdentifier() const
56{
57 return u"attributeEditorHtmlElement"_s;
58}
59
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.
QString htmlCode() const
The Html code that will be represented within this widget.
QgsAttributeEditorHtmlElement(const QString &name, QgsAttributeEditorElement *parent)
Creates a new element which can display HTML.
void setHtmlCode(const QString &htmlCode)
Sets the HTML code that will be represented within this widget to htmlCode.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
Container of fields for a vector layer.
Definition qgsfields.h:46
A container for the context for various read/write operations on objects.