QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
editform
qgsattributeeditorrelation.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsattributeeditorrelation.h - QgsAttributeEditorElement
3
4
---------------------
5
begin : 12.01.2021
6
copyright : (C) 2021 by Denis Rouzaud
7
email : denis@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 QGSATTRIBUTEEDITORRELATION_H
17
#define QGSATTRIBUTEEDITORRELATION_H
18
19
#include "qgis_core.h"
20
#include "
qgsattributeeditorelement.h
"
21
#include "
qgsrelation.h
"
22
23
#include <QColor>
24
25
class
QgsRelationManager
;
26
31
class
CORE_EXPORT
QgsAttributeEditorRelation
:
public
QgsAttributeEditorElement
32
{
33
Q_GADGET
34
public
:
40
enum
Button
SIP_ENUM_BASETYPE
( IntFlag )
41
{
42
Link
= 1 << 1,
43
Unlink
= 1 << 2,
44
SaveChildEdits
= 1 << 3,
45
AddChildFeature
= 1 << 4,
46
DuplicateChildFeature
= 1 << 5,
47
DeleteChildFeature
= 1 << 6,
48
ZoomToChildFeature
= 1 << 7,
49
AllButtons
=
Link
|
Unlink
|
SaveChildEdits
|
AddChildFeature
|
DuplicateChildFeature
|
DeleteChildFeature
|
ZoomToChildFeature
50
};
51
// TODO QGIS 5: remove
52
// this could not be tagged with Q_DECL_DEPRECATED due to Doxygen warning
53
54
Q_ENUM( Button )
55
Q_DECLARE_FLAGS(
Buttons
,
Button
)
56
Q_FLAG(
Buttons
)
57
61
Q_DECL_DEPRECATED
QgsAttributeEditorRelation
( const QString &
name
, const QString &relationId,
QgsAttributeEditorElement
*
parent
)
62
:
QgsAttributeEditorElement
(
Qgis
::AttributeEditorType::Relation,
name
,
parent
)
63
, mRelationId( relationId )
64
{}
65
69
Q_DECL_DEPRECATED
QgsAttributeEditorRelation
(
const
QString &
name
,
const
QgsRelation
&
relation
,
QgsAttributeEditorElement
*
parent
)
70
:
QgsAttributeEditorElement
(
Qgis
::AttributeEditorType::Relation,
name
,
parent
)
71
, mRelationId(
relation
.id() )
72
, mRelation(
relation
)
73
{}
74
81
QgsAttributeEditorRelation
(
const
QString &relationId,
QgsAttributeEditorElement
*
parent
)
82
:
QgsAttributeEditorElement
(
Qgis
::AttributeEditorType::Relation, relationId,
parent
)
83
, mRelationId( relationId )
84
{}
85
92
QgsAttributeEditorRelation
(
const
QgsRelation
&
relation
,
QgsAttributeEditorElement
*
parent
)
93
:
QgsAttributeEditorElement
(
Qgis
::AttributeEditorType::Relation,
relation
.id(),
parent
)
94
, mRelationId(
relation
.id() )
95
, mRelation(
relation
)
96
{}
97
98
104
const
QgsRelation
&
relation
()
const
{
return
mRelation; }
105
112
bool
init(
QgsRelationManager
*relManager );
113
114
QgsAttributeEditorElement
*
clone
(
QgsAttributeEditorElement
*parent )
const
override
SIP_FACTORY
;
115
120
bool
forceSuppressFormPopup()
const
;
121
128
void
setForceSuppressFormPopup(
bool
forceSuppressFormPopup );
129
134
QVariant nmRelationId()
const
;
135
141
void
setNmRelationId(
const
QVariant &nmRelationId = QVariant() );
142
147
QString label()
const
;
148
154
void
setLabel(
const
QString &label = QString() );
155
160
QString relationWidgetTypeId()
const
;
161
166
void
setRelationWidgetTypeId(
const
QString &relationWidgetTypeId );
167
173
QVariantMap relationEditorConfiguration()
const
;
174
180
void
setRelationEditorConfiguration(
const
QVariantMap &config );
181
182
private
:
183
void
saveConfiguration( QDomElement &elem, QDomDocument &doc )
const override
;
184
void
loadConfiguration(
const
QDomElement &element,
const
QString &layerId,
const
QgsReadWriteContext
&context,
const
QgsFields
&fields )
override
;
185
QString typeIdentifier()
const override
;
186
QString mRelationId;
187
QgsRelation
mRelation;
188
Q_NOWARN_DEPRECATED_PUSH
189
Buttons mButtons = Buttons( Button::AllButtons );
190
Q_NOWARN_DEPRECATED_POP
191
bool
mForceSuppressFormPopup =
false
;
192
QVariant mNmRelationId;
193
QString mLabel;
194
QString mRelationWidgetTypeId;
195
QVariantMap mRelationEditorConfig;
196
};
197
198
Q_NOWARN_DEPRECATED_PUSH
199
Q_DECLARE_OPERATORS_FOR_FLAGS
(
QgsAttributeEditorRelation::Buttons
)
200
Q_NOWARN_DEPRECATED_POP
201
202
#endif
// QGSATTRIBUTEEDITORRELATION_H
Qgis
Provides global constants and enumerations for use throughout the application.
Definition
qgis.h:62
QgsAttributeEditorElement
An abstract base class for any elements of a drag and drop form.
Definition
qgsattributeeditorelement.h:44
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::name
QString name() const
Returns the name of this element.
Definition
qgsattributeeditorelement.h:135
QgsAttributeEditorElement::clone
virtual QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const =0
Returns a clone of this element.
QgsAttributeEditorRelation::relation
const QgsRelation & relation() const
Gets the id of the relation which shall be embedded.
Definition
qgsattributeeditorrelation.h:104
QgsAttributeEditorRelation::QgsAttributeEditorRelation
Q_DECL_DEPRECATED QgsAttributeEditorRelation(const QString &name, const QgsRelation &relation, QgsAttributeEditorElement *parent)
Definition
qgsattributeeditorrelation.h:69
QgsAttributeEditorRelation::Button
Button
Possible buttons shown in the relation editor.
Definition
qgsattributeeditorrelation.h:41
QgsAttributeEditorRelation::DeleteChildFeature
@ DeleteChildFeature
Delete child feature button.
Definition
qgsattributeeditorrelation.h:47
QgsAttributeEditorRelation::AllButtons
@ AllButtons
All buttons.
Definition
qgsattributeeditorrelation.h:49
QgsAttributeEditorRelation::ZoomToChildFeature
@ ZoomToChildFeature
Zoom to child feature.
Definition
qgsattributeeditorrelation.h:48
QgsAttributeEditorRelation::Unlink
@ Unlink
Unlink button.
Definition
qgsattributeeditorrelation.h:43
QgsAttributeEditorRelation::AddChildFeature
@ AddChildFeature
Add child feature (as in some projects we only want to allow linking/unlinking existing features).
Definition
qgsattributeeditorrelation.h:45
QgsAttributeEditorRelation::DuplicateChildFeature
@ DuplicateChildFeature
Duplicate child feature.
Definition
qgsattributeeditorrelation.h:46
QgsAttributeEditorRelation::SaveChildEdits
@ SaveChildEdits
Save child edits button.
Definition
qgsattributeeditorrelation.h:44
QgsAttributeEditorRelation::Link
@ Link
Link button.
Definition
qgsattributeeditorrelation.h:42
QgsAttributeEditorRelation::Buttons
QFlags< Button > Buttons
Definition
qgsattributeeditorrelation.h:55
QgsAttributeEditorRelation::QgsAttributeEditorRelation
Q_DECL_DEPRECATED QgsAttributeEditorRelation(const QString &name, const QString &relationId, QgsAttributeEditorElement *parent)
Definition
qgsattributeeditorrelation.h:61
QgsAttributeEditorRelation::QgsAttributeEditorRelation
QgsAttributeEditorRelation(const QString &relationId, QgsAttributeEditorElement *parent)
Creates a new element which embeds a relation.
Definition
qgsattributeeditorrelation.h:81
QgsAttributeEditorRelation::QgsAttributeEditorRelation
QgsAttributeEditorRelation(const QgsRelation &relation, QgsAttributeEditorElement *parent)
Creates a new element which embeds a relation.
Definition
qgsattributeeditorrelation.h:92
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
QgsRelationManager
Manages a set of relations between layers.
Definition
qgsrelationmanager.h:36
QgsRelation
Represents a relationship between two vector layers.
Definition
qgsrelation.h:42
Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_POP
Definition
qgis.h:8379
Q_NOWARN_DEPRECATED_PUSH
#define Q_NOWARN_DEPRECATED_PUSH
Definition
qgis.h:8378
SIP_ENUM_BASETYPE
#define SIP_ENUM_BASETYPE(type)
Definition
qgis_sip.h:277
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
qgsattributeeditorelement.h
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTimeZoneComboBox::StandardItems)
qgsrelation.h
Generated on
for QGIS API Documentation by
1.17.0