QGIS API Documentation
3.30.0-'s-Hertogenbosch (f186b8efe0)
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
#include <QFont>
25
37
class
CORE_EXPORT
QgsAttributeEditorElement
SIP_ABSTRACT
38
{
39
40
#ifdef SIP_RUN
41
SIP_CONVERT_TO_SUBCLASS_CODE
42
switch
( sipCpp->type() )
43
{
44
case
QgsAttributeEditorElement::AeTypeContainer
:
45
sipType = sipType_QgsAttributeEditorContainer;
46
break
;
47
case
QgsAttributeEditorElement::AeTypeField
:
48
sipType = sipType_QgsAttributeEditorField;
49
break
;
50
case
QgsAttributeEditorElement::AeTypeRelation
:
51
sipType = sipType_QgsAttributeEditorRelation;
52
break
;
53
case
QgsAttributeEditorElement::AeTypeAction
:
54
sipType = sipType_QgsAttributeEditorAction;
55
break
;
56
default
:
57
sipType =
nullptr
;
58
break
;
59
}
60
SIP_END
61
#endif
62
public
:
63
68
struct
CORE_EXPORT
LabelStyle
69
{
70
72
QColor
color
;
73
75
QFont
font
;
76
78
bool
overrideColor =
false
;
79
81
bool
overrideFont =
false
;
82
87
void
readXml(
const
QDomNode &node )
SIP_SKIP
;
88
93
QDomElement writeXml( QDomDocument &document )
const
SIP_SKIP
;
94
99
bool
operator==
(
LabelStyle
const
&other )
const
SIP_SKIP
;
100
};
101
102
103
enum
AttributeEditorType
104
{
105
AeTypeContainer
,
106
AeTypeField
,
107
AeTypeRelation
,
108
AeTypeInvalid
,
109
AeTypeQmlElement
,
110
AeTypeHtmlElement
,
111
AeTypeAction
,
112
AeTypeTextElement
,
113
AeTypeSpacerElement
,
114
};
115
123
QgsAttributeEditorElement
(
AttributeEditorType
type,
const
QString &name,
QgsAttributeEditorElement
*parent =
nullptr
)
124
: mType( type )
125
, mName( name )
126
, mParent( parent )
127
, mShowLabel( true )
128
{}
129
130
virtual
~QgsAttributeEditorElement
() =
default
;
131
137
static
QgsAttributeEditorElement
*create(
const
QDomElement &element,
const
QString &layerId,
const
QgsFields
&fields,
const
QgsReadWriteContext
&context,
QgsAttributeEditorElement
*parent =
nullptr
)
SIP_FACTORY
;
138
144
QString name()
const
{
return
mName; }
145
151
AttributeEditorType
type
()
const
{
return
mType; }
152
158
QgsAttributeEditorElement
*
parent
()
const
{
return
mParent; }
159
167
QDomElement toDomElement( QDomDocument &doc )
const
;
168
174
virtual
QgsAttributeEditorElement
*
clone
(
QgsAttributeEditorElement
*parent )
const
= 0
SIP_FACTORY
;
175
181
bool
showLabel()
const
;
182
187
void
setShowLabel(
bool
showLabel );
188
194
LabelStyle
labelStyle()
const
;
195
201
void
setLabelStyle(
const
LabelStyle
&labelStyle );
202
203
204
protected
:
205
#ifndef SIP_RUN
206
AttributeEditorType
mType
;
207
QString
mName
;
208
QgsAttributeEditorElement
*mParent =
nullptr
;
209
bool
mShowLabel
;
210
LabelStyle
mLabelStyle
;
211
#endif
212
213
private
:
214
220
virtual
void
saveConfiguration( QDomElement &elem, QDomDocument &doc )
const
= 0;
221
226
virtual
void
loadConfiguration(
const
QDomElement &element,
const
QString &layerId,
const
QgsReadWriteContext
&context,
const
QgsFields
&fields ) = 0;
227
234
virtual
QString typeIdentifier()
const
= 0;
235
236
};
237
238
#endif
// QGSATTRIBUTEEDITORELEMENT_H
QgsAttributeEditorElement
This is an abstract base class for any elements of a drag and drop form.
Definition:
qgsattributeeditorelement.h:38
QgsAttributeEditorElement::mLabelStyle
LabelStyle mLabelStyle
Definition:
qgsattributeeditorelement.h:210
QgsAttributeEditorElement::parent
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
Definition:
qgsattributeeditorelement.h:158
QgsAttributeEditorElement::mName
QString mName
Definition:
qgsattributeeditorelement.h:207
QgsAttributeEditorElement::mShowLabel
bool mShowLabel
Definition:
qgsattributeeditorelement.h:209
QgsAttributeEditorElement::mType
AttributeEditorType mType
Definition:
qgsattributeeditorelement.h:206
QgsAttributeEditorElement::type
AttributeEditorType type() const
The type of this element.
Definition:
qgsattributeeditorelement.h:151
QgsAttributeEditorElement::QgsAttributeEditorElement
QgsAttributeEditorElement(AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
Constructor.
Definition:
qgsattributeeditorelement.h:123
QgsAttributeEditorElement::AttributeEditorType
AttributeEditorType
Definition:
qgsattributeeditorelement.h:104
QgsAttributeEditorElement::AeTypeTextElement
@ AeTypeTextElement
A text element (since QGIS 3.30)
Definition:
qgsattributeeditorelement.h:112
QgsAttributeEditorElement::AeTypeHtmlElement
@ AeTypeHtmlElement
A HTML element.
Definition:
qgsattributeeditorelement.h:110
QgsAttributeEditorElement::AeTypeInvalid
@ AeTypeInvalid
Invalid.
Definition:
qgsattributeeditorelement.h:108
QgsAttributeEditorElement::AeTypeSpacerElement
@ AeTypeSpacerElement
A spacer element (since QGIS 3.30)
Definition:
qgsattributeeditorelement.h:113
QgsAttributeEditorElement::AeTypeQmlElement
@ AeTypeQmlElement
A QML element.
Definition:
qgsattributeeditorelement.h:109
QgsAttributeEditorElement::AeTypeContainer
@ AeTypeContainer
A container.
Definition:
qgsattributeeditorelement.h:105
QgsAttributeEditorElement::AeTypeField
@ AeTypeField
A field.
Definition:
qgsattributeeditorelement.h:106
QgsAttributeEditorElement::AeTypeRelation
@ AeTypeRelation
A relation.
Definition:
qgsattributeeditorelement.h:107
QgsAttributeEditorElement::AeTypeAction
@ AeTypeAction
A layer action element (since QGIS 3.22)
Definition:
qgsattributeeditorelement.h:111
QgsAttributeEditorElement::~QgsAttributeEditorElement
virtual ~QgsAttributeEditorElement()=default
QgsAttributeEditorElement::clone
virtual QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const =0
Returns a clone of this element.
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:186
SIP_SKIP
#define SIP_SKIP
Definition:
qgis_sip.h:126
SIP_ABSTRACT
#define SIP_ABSTRACT
Definition:
qgis_sip.h:208
SIP_FACTORY
#define SIP_FACTORY
Definition:
qgis_sip.h:76
SIP_END
#define SIP_END
Definition:
qgis_sip.h:203
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition:
qgsfeatureiterator.h:425
qgsoptionalexpression.h
qgspropertycollection.h
qgsrelation.h
QgsAttributeEditorElement::LabelStyle
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.
Definition:
qgsattributeeditorelement.h:69
QgsAttributeEditorElement::LabelStyle::font
QFont font
Label font.
Definition:
qgsattributeeditorelement.h:75
QgsAttributeEditorElement::LabelStyle::color
QColor color
Label font.
Definition:
qgsattributeeditorelement.h:72
Generated on Sun Mar 5 2023 20:41:05 for QGIS API Documentation by
1.9.4