QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsrelationwidgetwrapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrelationwidgetwrapper.h
3  --------------------------------------
4  Date : 14.5.2014
5  Copyright : (C) 2014 Matthias Kuhn
6  Email : matthias at opengis dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSRELATIONWIDGETWRAPPER_H
17 #define QGSRELATIONWIDGETWRAPPER_H
18 
19 #include "qgswidgetwrapper.h"
20 #include "qgis_sip.h"
21 #include "qgis_gui.h"
22 #include "qgsattributeeditorrelation.h"
23 
24 
26 
32 class GUI_EXPORT QgsRelationWidgetWrapper : public QgsWidgetWrapper
33 {
34  Q_OBJECT
35 
36  public:
37 
40  QgsVectorLayer *vl,
41  const QgsRelation &relation,
42  QWidget *editor SIP_CONSTRAINED = nullptr,
43  QWidget *parent SIP_TRANSFERTHIS SIP_CONSTRAINED = nullptr
44  );
45 
48  const QString &relationEditorName,
49  QgsVectorLayer *vl,
50  const QgsRelation &relation,
51  QWidget *editor = nullptr,
52  QWidget *parent SIP_TRANSFERTHIS = nullptr
53  );
54 
62  Q_DECL_DEPRECATED bool showLabel() const SIP_DEPRECATED;
63 
71  Q_DECL_DEPRECATED void setShowLabel( bool showLabel ) SIP_DEPRECATED;
72 
78  Q_DECL_DEPRECATED bool showLinkButton() const SIP_DEPRECATED;
79 
85  Q_DECL_DEPRECATED void setShowLinkButton( bool showLinkButton ) SIP_DEPRECATED;
86 
92  Q_DECL_DEPRECATED bool showUnlinkButton() const SIP_DEPRECATED;
93 
99  Q_DECL_DEPRECATED void setShowUnlinkButton( bool showUnlinkButton ) SIP_DEPRECATED;
100 
106  Q_DECL_DEPRECATED void setShowSaveChildEditsButton( bool showChildEdits ) SIP_DEPRECATED;
107 
113  Q_DECL_DEPRECATED bool showSaveChildEditsButton() const SIP_DEPRECATED;
114 
120  Q_DECL_DEPRECATED void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons ) SIP_DEPRECATED;
121 
127  Q_DECL_DEPRECATED QgsAttributeEditorRelation::Buttons visibleButtons() const SIP_DEPRECATED;
128 
129 
136  void setWidgetConfig( const QVariantMap &config );
137 
142  QVariantMap widgetConfig() const;
143 
148  bool forceSuppressFormPopup() const;
149 
157  void setForceSuppressFormPopup( bool forceSuppressFormPopup );
158 
163  QVariant nmRelationId() const;
164 
170  void setNmRelationId( const QVariant &nmRelationId = QVariant() );
171 
177  Q_DECL_DEPRECATED QString label() const SIP_DEPRECATED;
178 
185  Q_DECL_DEPRECATED void setLabel( const QString &label = QString() ) SIP_DEPRECATED;
186 
192  QgsRelation relation() const;
193 
205  void widgetValueChanged( const QString &attribute, const QVariant &newValue, bool attributeChanged );
206 
207 
208  protected:
209  QWidget *createWidget( QWidget *parent ) override;
210  void initWidget( QWidget *editor ) override;
211  bool valid() const override;
212 
213  public slots:
214  void setFeature( const QgsFeature &feature ) override;
215 
221  void setVisible( bool visible );
222 
223  private:
224  void aboutToSave() override;
225  QgsRelation mRelation;
226  QgsRelation mNmRelation;
227  QString mRelationEditorId;
228  QgsAbstractRelationEditorWidget *mWidget = nullptr;
229 };
230 
231 #endif // QGSRELATIONWIDGETWRAPPER_H
Base class to build new relation widgets.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Represents a vector layer which manages a vector based data sets.
Manages an editor widget Widget and wrapper share the same parent.
virtual void setFeature(const QgsFeature &feature)=0
Is called when the value of the widget needs to be changed.
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_CONSTRAINED
Definition: qgis_sip.h:111