QGIS API Documentation
3.22.4-Białowieża (ce8e65e95e)
src
core
editform
qgsattributeeditorelement.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsattributeeditorelement.h - QgsAttributeEditorElement
3
4
---------------------
5
begin : 18.8.2016
6
copyright : (C) 2016 by Matthias Kuhn
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
#ifndef QGSATTRIBUTEEDITORELEMENT_H
17
#define QGSATTRIBUTEEDITORELEMENT_H
18
19
#include "qgis_core.h"
20
#include "
qgsrelation.h
"
21
#include "
qgsoptionalexpression.h
"
22
#include "
qgspropertycollection.h
"
23
#include <QColor>
24
36
class
CORE_EXPORT
QgsAttributeEditorElement
SIP_ABSTRACT
37
{
38
39
#ifdef SIP_RUN
40
SIP_CONVERT_TO_SUBCLASS_CODE
41
switch
( sipCpp->type() )
42
{
43
case
QgsAttributeEditorElement::AeTypeContainer
:
44
sipType = sipType_QgsAttributeEditorContainer;
45
break
;
46
case
QgsAttributeEditorElement::AeTypeField
:
47
sipType = sipType_QgsAttributeEditorField;
48
break
;
49
case
QgsAttributeEditorElement::AeTypeRelation
:
50
sipType = sipType_QgsAttributeEditorRelation;
51
break
;
52
case
QgsAttributeEditorElement::AeTypeAction
:
53
sipType = sipType_QgsAttributeEditorAction;
54
break
;
55
default
:
56
sipType =
nullptr
;
57
break
;
58
}
59
SIP_END
60
#endif
61
public
:
62
enum
AttributeEditorType
63
{
64
AeTypeContainer
,
65
AeTypeField
,
66
AeTypeRelation
,
67
AeTypeInvalid
,
68
AeTypeQmlElement
,
69
AeTypeHtmlElement
,
70
AeTypeAction
71
};
72
80
QgsAttributeEditorElement
(
AttributeEditorType
type,
const
QString &name,
QgsAttributeEditorElement
*parent =
nullptr
)
81
: mType( type )
82
, mName( name )
83
, mParent( parent )
84
, mShowLabel( true )
85
{}
86
87
virtual
~QgsAttributeEditorElement
() =
default
;
88
94
static
QgsAttributeEditorElement
*create(
const
QDomElement &element,
const
QString &layerId,
const
QgsFields
&fields,
const
QgsReadWriteContext
&context,
QgsAttributeEditorElement
*parent =
nullptr
)
SIP_FACTORY
;
95
101
QString name()
const
{
return
mName; }
102
108
AttributeEditorType
type
()
const
{
return
mType; }
109
115
QgsAttributeEditorElement
*
parent
()
const
{
return
mParent; }
116
124
QDomElement toDomElement( QDomDocument &doc )
const
;
125
131
virtual
QgsAttributeEditorElement
*
clone
(
QgsAttributeEditorElement
*parent )
const
= 0
SIP_FACTORY
;
132
138
bool
showLabel()
const
;
139
144
void
setShowLabel(
bool
showLabel );
145
146
protected
:
147
#ifndef SIP_RUN
148
AttributeEditorType
mType
;
149
QString
mName
;
150
QgsAttributeEditorElement
*mParent =
nullptr
;
151
bool
mShowLabel
;
152
#endif
153
154
private
:
155
161
virtual
void
saveConfiguration( QDomElement &elem, QDomDocument &doc )
const
= 0;
162
167
virtual
void
loadConfiguration(
const
QDomElement &element,
const
QString &layerId,
const
QgsReadWriteContext
&context,
const
QgsFields
&fields ) = 0;
168
175
virtual
QString typeIdentifier()
const
= 0;
176
177
};
178
179
#endif
// QGSATTRIBUTEEDITORELEMENT_H
QgsAttributeEditorElement
This is an abstract base class for any elements of a drag and drop form.
Definition:
qgsattributeeditorelement.h:37
QgsAttributeEditorElement::clone
virtual QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const =0
Returns a clone of this element.
QgsAttributeEditorElement::mName
QString mName
Definition:
qgsattributeeditorelement.h:149
QgsAttributeEditorElement::mShowLabel
bool mShowLabel
Definition:
qgsattributeeditorelement.h:151
QgsAttributeEditorElement::mType
AttributeEditorType mType
Definition:
qgsattributeeditorelement.h:148
QgsAttributeEditorElement::type
AttributeEditorType type() const
The type of this element.
Definition:
qgsattributeeditorelement.h:108
QgsAttributeEditorElement::QgsAttributeEditorElement
QgsAttributeEditorElement(AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
Constructor.
Definition:
qgsattributeeditorelement.h:80
QgsAttributeEditorElement::AttributeEditorType
AttributeEditorType
Definition:
qgsattributeeditorelement.h:63
QgsAttributeEditorElement::AeTypeHtmlElement
@ AeTypeHtmlElement
A HTML element.
Definition:
qgsattributeeditorelement.h:69
QgsAttributeEditorElement::AeTypeInvalid
@ AeTypeInvalid
Invalid.
Definition:
qgsattributeeditorelement.h:67
QgsAttributeEditorElement::AeTypeQmlElement
@ AeTypeQmlElement
A QML element.
Definition:
qgsattributeeditorelement.h:68
QgsAttributeEditorElement::AeTypeContainer
@ AeTypeContainer
A container.
Definition:
qgsattributeeditorelement.h:64
QgsAttributeEditorElement::AeTypeField
@ AeTypeField
A field.
Definition:
qgsattributeeditorelement.h:65
QgsAttributeEditorElement::AeTypeRelation
@ AeTypeRelation
A relation.
Definition:
qgsattributeeditorelement.h:66
QgsAttributeEditorElement::AeTypeAction
@ AeTypeAction
A layer action element (since QGIS 3.22)
Definition:
qgsattributeeditorelement.h:70
QgsAttributeEditorElement::~QgsAttributeEditorElement
virtual ~QgsAttributeEditorElement()=default
QgsAttributeEditorElement::parent
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
Definition:
qgsattributeeditorelement.h:115
QgsFields
Container of fields for a vector layer.
Definition:
qgsfields.h:45
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition:
qgsreadwritecontext.h:35
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition:
qgis_sip.h:177
SIP_ABSTRACT
#define SIP_ABSTRACT
Definition:
qgis_sip.h:199
SIP_FACTORY
#define SIP_FACTORY
Definition:
qgis_sip.h:76
SIP_END
#define SIP_END
Definition:
qgis_sip.h:194
qgsoptionalexpression.h
qgspropertycollection.h
qgsrelation.h
Generated on Thu Feb 24 2022 10:41:09 for QGIS API Documentation by
1.9.1