QGIS API Documentation 3.99.0-Master (26c88405ac0)
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
23#include <QColor>
24
26
32{
33 Q_GADGET
34 public:
35
52 // TODO QGIS 4: remove
53 // this could not be tagged with Q_DECL_DEPRECATED due to Doxygen warning
54
55 Q_ENUM( Button )
56 Q_DECLARE_FLAGS( Buttons, Button )
57 Q_FLAG( Buttons )
58
62 Q_DECL_DEPRECATED QgsAttributeEditorRelation( const QString &name, const QString &relationId, QgsAttributeEditorElement *parent )
63 : QgsAttributeEditorElement( Qgis::AttributeEditorType::Relation, name, parent )
64 , mRelationId( relationId )
65 {}
66
71 : QgsAttributeEditorElement( Qgis::AttributeEditorType::Relation, name, parent )
72 , mRelationId( relation.id() )
73 , mRelation( relation )
74 {}
75
83 : QgsAttributeEditorElement( Qgis::AttributeEditorType::Relation, relationId, parent )
84 , mRelationId( relationId )
85 {}
86
94 : QgsAttributeEditorElement( Qgis::AttributeEditorType::Relation, relation.id(), parent )
95 , mRelationId( relation.id() )
96 , mRelation( relation )
97 {}
98
99
105 const QgsRelation &relation() const { return mRelation; }
106
113 bool init( QgsRelationManager *relManager );
114
116
121 bool forceSuppressFormPopup() const;
122
129 void setForceSuppressFormPopup( bool forceSuppressFormPopup );
130
135 QVariant nmRelationId() const;
136
142 void setNmRelationId( const QVariant &nmRelationId = QVariant() );
143
148 QString label() const;
149
155 void setLabel( const QString &label = QString() );
156
161 QString relationWidgetTypeId() const;
162
167 void setRelationWidgetTypeId( const QString &relationWidgetTypeId );
168
174 QVariantMap relationEditorConfiguration() const;
175
181 void setRelationEditorConfiguration( const QVariantMap &config );
182
183 private:
184 void saveConfiguration( QDomElement &elem, QDomDocument &doc ) const override;
185 void loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields ) override;
186 QString typeIdentifier() const override;
187 QString mRelationId;
188 QgsRelation mRelation;
190 Buttons mButtons = Buttons( Button::AllButtons );
192 bool mForceSuppressFormPopup = false;
193 QVariant mNmRelationId;
194 QString mLabel;
195 QString mRelationWidgetTypeId;
196 QVariantMap mRelationEditorConfig;
197};
198
202
203#endif // QGSATTRIBUTEEDITORRELATION_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
An abstract base class for any elements of a drag and drop form.
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
QgsAttributeEditorElement(Qgis::AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
Constructor.
QString name() const
Returns the name of this element.
virtual QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const =0
Returns a clone of this element.
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.
@ DeleteChildFeature
Delete child feature button.
@ ZoomToChildFeature
Zoom to child feature.
@ AddChildFeature
Add child feature (as in some projects we only want to allow linking/unlinking existing features).
@ DuplicateChildFeature
Duplicate child feature.
@ SaveChildEdits
Save child edits button.
Q_DECL_DEPRECATED QgsAttributeEditorRelation(const QString &name, const QString &relationId, QgsAttributeEditorElement *parent)
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
A container for the context for various read/write operations on objects.
Manages a set of relations between layers.
Represents a relationship between two vector layers.
Definition qgsrelation.h:42
#define Q_NOWARN_DEPRECATED_POP
Definition qgis.h:7170
#define Q_NOWARN_DEPRECATED_PUSH
Definition qgis.h:7169
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:275
#define SIP_FACTORY
Definition qgis_sip.h:84
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)