QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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 
61  bool showLabel() const;
62 
69  void setShowLabel( bool showLabel );
70 
76  Q_DECL_DEPRECATED bool showLinkButton() const SIP_DEPRECATED;
77 
83  Q_DECL_DEPRECATED void setShowLinkButton( bool showLinkButton ) SIP_DEPRECATED;
84 
90  Q_DECL_DEPRECATED bool showUnlinkButton() const SIP_DEPRECATED;
91 
97  Q_DECL_DEPRECATED void setShowUnlinkButton( bool showUnlinkButton ) SIP_DEPRECATED;
98 
104  Q_DECL_DEPRECATED void setShowSaveChildEditsButton( bool showChildEdits ) SIP_DEPRECATED;
105 
111  Q_DECL_DEPRECATED bool showSaveChildEditsButton() const SIP_DEPRECATED;
112 
118  Q_DECL_DEPRECATED void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons ) SIP_DEPRECATED;
119 
125  Q_DECL_DEPRECATED QgsAttributeEditorRelation::Buttons visibleButtons() const SIP_DEPRECATED;
126 
127 
134  void setWidgetConfig( const QVariantMap &config );
135 
140  QVariantMap widgetConfig() const;
141 
146  bool forceSuppressFormPopup() const;
147 
155  void setForceSuppressFormPopup( bool forceSuppressFormPopup );
156 
161  QVariant nmRelationId() const;
162 
168  void setNmRelationId( const QVariant &nmRelationId = QVariant() );
169 
174  QString label() const;
175 
181  void setLabel( const QString &label = QString() );
182 
188  QgsRelation relation() const;
189 
201  void widgetValueChanged( const QString &attribute, const QVariant &newValue, bool attributeChanged );
202 
203 
204  protected:
205  QWidget *createWidget( QWidget *parent ) override;
206  void initWidget( QWidget *editor ) override;
207  bool valid() const override;
208 
209  public slots:
210  void setFeature( const QgsFeature &feature ) override;
211 
217  void setVisible( bool visible );
218 
219  private:
220  void aboutToSave() override;
221  QgsRelation mRelation;
222  QgsRelation mNmRelation;
223  QString mRelationEditorId;
224  QgsAbstractRelationEditorWidget *mWidget = nullptr;
225 };
226 
227 #endif // QGSRELATIONWIDGETWRAPPER_H
Base class to build new relation widgets.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
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