QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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"
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  signals:
214 
222  void relatedFeaturesChanged();
223 
224  public slots:
225  void setFeature( const QgsFeature &feature ) override;
226 
232  void setMultiEditFeatureIds( const QgsFeatureIds &fids );
233 
239  void setVisible( bool visible );
240 
241  private:
242  void aboutToSave() override;
243  QgsRelation mRelation;
244  QgsRelation mNmRelation;
245  QString mRelationEditorId;
246  QgsAbstractRelationEditorWidget *mWidget = nullptr;
247 };
248 
249 #endif // QGSRELATIONWIDGETWRAPPER_H
QgsWidgetWrapper::initWidget
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
Definition: qgswidgetwrapper.cpp:107
QgsWidgetWrapper::valid
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
QgsWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition: qgswidgetwrapper.h:52
qgsattributeeditorrelation.h
QgsRelationWidgetWrapper
Definition: qgsrelationwidgetwrapper.h:32
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
qgis_sip.h
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
QgsWidgetWrapper::setFeature
virtual void setFeature(const QgsFeature &feature)=0
Is called when the value of the widget needs to be changed.
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
qgswidgetwrapper.h
QgsRelation
Definition: qgsrelation.h:42
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:55
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsAbstractRelationEditorWidget
Base class to build new relation widgets.
Definition: qgsabstractrelationeditorwidget.h:45
QgsWidgetWrapper::createWidget
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
SIP_CONSTRAINED
#define SIP_CONSTRAINED
Definition: qgis_sip.h:111