QGIS API Documentation
3.28.0-Firenze (ed3ad0430f)
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
};
113
121
QgsAttributeEditorElement
(
AttributeEditorType
type,
const
QString &name,
QgsAttributeEditorElement
*parent =
nullptr
)
122
: mType( type )
123
, mName( name )
124
, mParent( parent )
125
, mShowLabel( true )
126
{}
127
128
virtual
~QgsAttributeEditorElement
() =
default
;
129
135
static
QgsAttributeEditorElement
*create(
const
QDomElement &element,
const
QString &layerId,
const
QgsFields
&fields,
const
QgsReadWriteContext
&context,
QgsAttributeEditorElement
*parent =
nullptr
)
SIP_FACTORY
;
136
142
QString name()
const
{
return
mName; }
143
149
AttributeEditorType
type
()
const
{
return
mType; }
150
156
QgsAttributeEditorElement
*
parent
()
const
{
return
mParent; }
157
165
QDomElement toDomElement( QDomDocument &doc )
const
;
166
172
virtual
QgsAttributeEditorElement
*
clone
(
QgsAttributeEditorElement
*parent )
const
= 0
SIP_FACTORY
;
173
179
bool
showLabel()
const
;
180
185
void
setShowLabel(
bool
showLabel );
186
192
LabelStyle
labelStyle()
const
;
193
199
void
setLabelStyle(
const
LabelStyle
&labelStyle );
200
201
202
protected
:
203
#ifndef SIP_RUN
204
AttributeEditorType
mType
;
205
QString
mName
;
206
QgsAttributeEditorElement
*mParent =
nullptr
;
207
bool
mShowLabel
;
208
LabelStyle
mLabelStyle
;
209
#endif
210
211
private
:
212
218
virtual
void
saveConfiguration( QDomElement &elem, QDomDocument &doc )
const
= 0;
219
224
virtual
void
loadConfiguration(
const
QDomElement &element,
const
QString &layerId,
const
QgsReadWriteContext
&context,
const
QgsFields
&fields ) = 0;
225
232
virtual
QString typeIdentifier()
const
= 0;
233
234
};
235
236
#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:208
QgsAttributeEditorElement::parent
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
Definition:
qgsattributeeditorelement.h:156
QgsAttributeEditorElement::mName
QString mName
Definition:
qgsattributeeditorelement.h:205
QgsAttributeEditorElement::mShowLabel
bool mShowLabel
Definition:
qgsattributeeditorelement.h:207
QgsAttributeEditorElement::mType
AttributeEditorType mType
Definition:
qgsattributeeditorelement.h:204
QgsAttributeEditorElement::type
AttributeEditorType type() const
The type of this element.
Definition:
qgsattributeeditorelement.h:149
QgsAttributeEditorElement::QgsAttributeEditorElement
QgsAttributeEditorElement(AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
Constructor.
Definition:
qgsattributeeditorelement.h:121
QgsAttributeEditorElement::AttributeEditorType
AttributeEditorType
Definition:
qgsattributeeditorelement.h:104
QgsAttributeEditorElement::AeTypeHtmlElement
@ AeTypeHtmlElement
A HTML element.
Definition:
qgsattributeeditorelement.h:110
QgsAttributeEditorElement::AeTypeInvalid
@ AeTypeInvalid
Invalid.
Definition:
qgsattributeeditorelement.h:108
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 Sat Oct 22 2022 16:10:47 for QGIS API Documentation by
1.9.4