QGIS API Documentation
3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
src
core
editform
qgsattributeeditorqmlelement.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsattributeeditorqmlelement.cpp - QgsAttributeEditorQmlelement
3
4
---------------------
5
begin : 12.01.2021
6
copyright : (C) 2021 by Denis Rouzaud
7
email :
[email protected]
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
***************************************************************************/
16
#include "
qgsattributeeditorqmlelement.h
"
17
18
#include <QDomText>
19
#include <QString>
20
21
using namespace
Qt::StringLiterals;
22
23
QgsAttributeEditorElement
*
QgsAttributeEditorQmlElement::clone
(
QgsAttributeEditorElement
*
parent
)
const
24
{
25
QgsAttributeEditorQmlElement
*element =
new
QgsAttributeEditorQmlElement
(
name
(),
parent
);
26
element->
setQmlCode
( mQmlCode );
27
28
return
element;
29
}
30
31
QString
QgsAttributeEditorQmlElement::qmlCode
()
const
32
{
33
return
mQmlCode;
34
}
35
36
void
QgsAttributeEditorQmlElement::setQmlCode
(
const
QString &
qmlCode
)
37
{
38
mQmlCode =
qmlCode
;
39
}
40
41
void
QgsAttributeEditorQmlElement::saveConfiguration( QDomElement &elem, QDomDocument &doc )
const
42
{
43
const
QDomText codeElem = doc.createTextNode( mQmlCode );
44
elem.appendChild( codeElem );
45
}
46
47
void
QgsAttributeEditorQmlElement::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
setQmlCode
( element.text() );
53
}
54
55
QString QgsAttributeEditorQmlElement::typeIdentifier()
const
56
{
57
return
u
"attributeEditorQmlElement"
_s;
58
}
59
QgsAttributeEditorElement::parent
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
Definition
qgsattributeeditorelement.h:148
QgsAttributeEditorElement::QgsAttributeEditorElement
QgsAttributeEditorElement(Qgis::AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
Constructor.
Definition
qgsattributeeditorelement.h:115
QgsAttributeEditorElement::name
QString name() const
Returns the name of this element.
Definition
qgsattributeeditorelement.h:135
QgsAttributeEditorQmlElement::clone
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
Definition
qgsattributeeditorqmlelement.cpp:23
QgsAttributeEditorQmlElement::qmlCode
QString qmlCode() const
The QML code that will be represented within this widget.
Definition
qgsattributeeditorqmlelement.cpp:31
QgsAttributeEditorQmlElement::QgsAttributeEditorQmlElement
QgsAttributeEditorQmlElement(const QString &name, QgsAttributeEditorElement *parent)
Creates a new element which can display QML.
Definition
qgsattributeeditorqmlelement.h:38
QgsAttributeEditorQmlElement::setQmlCode
void setQmlCode(const QString &qmlCode)
Sets the QML code that will be represented within this widget to qmlCode.
Definition
qgsattributeeditorqmlelement.cpp:36
QgsFields
Container of fields for a vector layer.
Definition
qgsfields.h:46
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
qgsattributeeditorqmlelement.h
Generated on
for QGIS API Documentation by
1.15.0