QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
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 : matthias@opengis.ch
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.h
"
20
#include "qgis_core.h"
21
#include "
qgis_sip.h
"
22
23
#include <QColor>
24
#include <QFont>
25
26
class
QDomNode;
27
class
QDomElement;
28
class
QDomDocument;
29
class
QgsFields
;
30
class
QgsReadWriteContext
;
31
42
43
class
CORE_EXPORT
QgsAttributeEditorElement
SIP_ABSTRACT
44
{
45
#ifdef SIP_RUN
46
SIP_CONVERT_TO_SUBCLASS_CODE
47
switch
( sipCpp->type() )
48
{
49
case
Qgis::AttributeEditorType::Container
:
50
sipType = sipType_QgsAttributeEditorContainer;
51
break
;
52
case
Qgis::AttributeEditorType::Field
:
53
sipType = sipType_QgsAttributeEditorField;
54
break
;
55
case
Qgis::AttributeEditorType::Relation
:
56
sipType = sipType_QgsAttributeEditorRelation;
57
break
;
58
case
Qgis::AttributeEditorType::Action
:
59
sipType = sipType_QgsAttributeEditorAction;
60
break
;
61
default
:
62
sipType =
nullptr
;
63
break
;
64
}
65
SIP_END
66
#endif
67
68
public
:
73
struct
CORE_EXPORT
LabelStyle
74
{
76
QColor
color
;
77
79
QFont
font
;
80
82
bool
overrideColor
=
false
;
83
85
bool
overrideFont
=
false
;
86
91
void
readXml
(
const
QDomNode &node )
SIP_SKIP
;
92
97
QDomElement
writeXml
( QDomDocument &document )
const
SIP_SKIP
;
98
103
bool
operator==
(
LabelStyle
const
&other )
const
SIP_SKIP
;
104
};
105
113
QgsAttributeEditorElement
(
Qgis::AttributeEditorType
type
,
const
QString &
name
,
QgsAttributeEditorElement
*
parent
=
nullptr
)
114
:
mType
(
type
)
115
,
mName
(
name
)
116
,
mParent
(
parent
)
117
{}
118
119
virtual
~QgsAttributeEditorElement
() =
default
;
120
121
// clang-format off
127
static
std::unique_ptr<QgsAttributeEditorElement>
create
(
const
QDomElement &element,
const
QString &layerId,
const
QgsFields
&fields,
const
QgsReadWriteContext
&context,
QgsAttributeEditorElement
*
parent
=
nullptr
);
128
// clang-format on
129
135
QString
name
()
const
{
return
mName
; }
136
142
Qgis::AttributeEditorType
type
()
const
{
return
mType
; }
143
148
QgsAttributeEditorElement
*
parent
()
const
{
return
mParent
; }
149
157
QDomElement toDomElement( QDomDocument &doc )
const
;
158
163
virtual
QgsAttributeEditorElement
*
clone
(
QgsAttributeEditorElement
*
parent
)
const
= 0
SIP_FACTORY
;
164
169
bool
showLabel
()
const
;
170
174
void
setShowLabel
(
bool
showLabel
);
175
184
int
horizontalStretch
()
const
{
return
mHorizontalStretch
; }
185
194
void
setHorizontalStretch
(
int
stretch ) {
mHorizontalStretch
= stretch; }
195
204
int
verticalStretch
()
const
{
return
mVerticalStretch
; }
205
214
void
setVerticalStretch
(
int
stretch ) {
mVerticalStretch
= stretch; }
215
221
LabelStyle labelStyle()
const
;
222
228
void
setLabelStyle(
const
LabelStyle &labelStyle );
229
230
231
protected
:
232
#ifndef SIP_RUN
233
Qgis::AttributeEditorType
mType
=
Qgis::AttributeEditorType::Invalid
;
234
QString
mName
;
235
QgsAttributeEditorElement
*
mParent
=
nullptr
;
236
bool
mShowLabel
=
true
;
237
int
mHorizontalStretch
= 0;
238
int
mVerticalStretch
= 0;
239
LabelStyle
mLabelStyle
;
240
#endif
241
242
private
:
247
virtual
void
saveConfiguration( QDomElement &elem, QDomDocument &doc )
const
= 0;
248
253
virtual
void
loadConfiguration(
const
QDomElement &element,
const
QString &layerId,
const
QgsReadWriteContext
&context,
const
QgsFields
&fields ) = 0;
254
260
virtual
QString typeIdentifier()
const
= 0;
261
};
262
263
#endif
// QGSATTRIBUTEEDITORELEMENT_H
Qgis::AttributeEditorType
AttributeEditorType
Attribute editor types.
Definition
qgis.h:6271
Qgis::AttributeEditorType::Action
@ Action
A layer action element.
Definition
qgis.h:6277
Qgis::AttributeEditorType::Container
@ Container
A container.
Definition
qgis.h:6272
Qgis::AttributeEditorType::Invalid
@ Invalid
Invalid.
Definition
qgis.h:6280
Qgis::AttributeEditorType::Relation
@ Relation
A relation.
Definition
qgis.h:6274
Qgis::AttributeEditorType::Field
@ Field
A field.
Definition
qgis.h:6273
QgsAttributeEditorElement::setHorizontalStretch
void setHorizontalStretch(int stretch)
Sets the horizontal stretch factor for the element.
Definition
qgsattributeeditorelement.h:194
QgsAttributeEditorElement::create
static std::unique_ptr< QgsAttributeEditorElement > create(const QDomElement &element, const QString &layerId, const QgsFields &fields, const QgsReadWriteContext &context, QgsAttributeEditorElement *parent=nullptr)
Constructs the editor element from the given element.
Definition
qgsattributeeditorelement.cpp:66
QgsAttributeEditorElement::mLabelStyle
LabelStyle mLabelStyle
Definition
qgsattributeeditorelement.h:239
QgsAttributeEditorElement::mVerticalStretch
int mVerticalStretch
Definition
qgsattributeeditorelement.h:238
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:113
QgsAttributeEditorElement::mName
QString mName
Definition
qgsattributeeditorelement.h:234
QgsAttributeEditorElement::mShowLabel
bool mShowLabel
Definition
qgsattributeeditorelement.h:236
QgsAttributeEditorElement::mParent
QgsAttributeEditorElement * mParent
Definition
qgsattributeeditorelement.h:235
QgsAttributeEditorElement::type
Qgis::AttributeEditorType type() const
The type of this element.
Definition
qgsattributeeditorelement.h:142
QgsAttributeEditorElement::verticalStretch
int verticalStretch() const
Returns the vertical stretch factor for the element.
Definition
qgsattributeeditorelement.h:204
QgsAttributeEditorElement::mType
Qgis::AttributeEditorType mType
Definition
qgsattributeeditorelement.h:233
QgsAttributeEditorElement::showLabel
bool showLabel() const
Controls if this element should be labeled with a title (field, relation or groupname).
Definition
qgsattributeeditorelement.cpp:46
QgsAttributeEditorElement::name
QString name() const
Returns the name of this element.
Definition
qgsattributeeditorelement.h:135
QgsAttributeEditorElement::setVerticalStretch
void setVerticalStretch(int stretch)
Sets the vertical stretch factor for the element.
Definition
qgsattributeeditorelement.h:214
QgsAttributeEditorElement::setShowLabel
void setShowLabel(bool showLabel)
Controls if this element should be labeled with a title (field, relation or groupname).
Definition
qgsattributeeditorelement.cpp:51
QgsAttributeEditorElement::~QgsAttributeEditorElement
virtual ~QgsAttributeEditorElement()=default
QgsAttributeEditorElement::horizontalStretch
int horizontalStretch() const
Returns the horizontal stretch factor for the element.
Definition
qgsattributeeditorelement.h:184
QgsAttributeEditorElement::mHorizontalStretch
int mHorizontalStretch
Definition
qgsattributeeditorelement.h:237
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
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
qgis.h
qgis_sip.h
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition
qgis_sip.h:203
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
SIP_ABSTRACT
#define SIP_ABSTRACT
Definition
qgis_sip.h:225
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
SIP_END
#define SIP_END
Definition
qgis_sip.h:220
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition
qgsfeatureiterator.h:427
QgsAttributeEditorElement::LabelStyle
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.
Definition
qgsattributeeditorelement.h:74
QgsAttributeEditorElement::LabelStyle::readXml
void readXml(const QDomNode &node)
Reads configuration from node.
Definition
qgsattributeeditorelement.cpp:132
QgsAttributeEditorElement::LabelStyle::overrideColor
bool overrideColor
Override label color.
Definition
qgsattributeeditorelement.h:82
QgsAttributeEditorElement::LabelStyle::font
QFont font
Label font.
Definition
qgsattributeeditorelement.h:79
QgsAttributeEditorElement::LabelStyle::color
QColor color
Label font.
Definition
qgsattributeeditorelement.h:76
QgsAttributeEditorElement::LabelStyle::writeXml
QDomElement writeXml(QDomDocument &document) const
Creates the XML configuration from document.
Definition
qgsattributeeditorelement.cpp:161
QgsAttributeEditorElement::LabelStyle::overrideFont
bool overrideFont
Override label font.
Definition
qgsattributeeditorelement.h:85
Generated on
for QGIS API Documentation by
1.17.0