QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
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"
21#include "qgsrelation.h"
22#include <QColor>
23
25
31{
32 Q_GADGET
33 public:
34
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 4: 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
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
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;
189 Buttons mButtons = Buttons( Button::AllButtons );
191 bool mForceSuppressFormPopup = false;
192 QVariant mNmRelationId;
193 QString mLabel;
194 QString mRelationWidgetTypeId;
195 QVariantMap mRelationEditorConfig;
196};
197
201
202#endif // QGSATTRIBUTEEDITORRELATION_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
This is an abstract base class for any elements of a drag and drop form.
virtual QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const =0
Returns a clone of this element.
This element will load a relation editor onto the form.
const QgsRelation & relation() const
Gets the id of the relation which shall be embedded.
Q_DECL_DEPRECATED QgsAttributeEditorRelation(const QString &name, const QgsRelation &relation, QgsAttributeEditorElement *parent)
Button
Possible buttons shown in the relation editor.
QgsAttributeEditorRelation(const QString &relationId, QgsAttributeEditorElement *parent)
Creates a new element which embeds a relation.
QgsAttributeEditorRelation(const QgsRelation &relation, QgsAttributeEditorElement *parent)
Creates a new element which embeds a relation.
Container of fields for a vector layer.
Definition qgsfields.h:46
The class is used as a container of context for various read/write operations on other objects.
This class manages a set of relations between layers.
Represents a relationship between two vector layers.
Definition qgsrelation.h:44
#define Q_NOWARN_DEPRECATED_POP
Definition qgis.h:6643
#define Q_NOWARN_DEPRECATED_PUSH
Definition qgis.h:6642
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:278
#define SIP_FACTORY
Definition qgis_sip.h:76
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)