QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
24 
30 class GUI_EXPORT QgsRelationWidgetWrapper : public QgsWidgetWrapper
31 {
32  Q_OBJECT
33 
34  public:
35 
37  explicit QgsRelationWidgetWrapper( QgsVectorLayer *vl, const QgsRelation &relation, QWidget *editor = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
38 
45  bool showLabel() const;
46 
53  void setShowLabel( bool showLabel );
54 
60  Q_DECL_DEPRECATED bool showLinkButton() const SIP_DEPRECATED;
61 
67  Q_DECL_DEPRECATED void setShowLinkButton( bool showLinkButton ) SIP_DEPRECATED;
68 
74  Q_DECL_DEPRECATED bool showUnlinkButton() const SIP_DEPRECATED;
75 
81  Q_DECL_DEPRECATED void setShowUnlinkButton( bool showUnlinkButton ) SIP_DEPRECATED;
82 
88  Q_DECL_DEPRECATED void setShowSaveChildEditsButton( bool showChildEdits ) SIP_DEPRECATED;
89 
95  Q_DECL_DEPRECATED bool showSaveChildEditsButton() const SIP_DEPRECATED;
96 
101  void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons );
102 
107  QgsAttributeEditorRelation::Buttons visibleButtons() const;
108 
113  bool forceSuppressFormPopup() const;
114 
122  void setForceSuppressFormPopup( bool forceSuppressFormPopup );
123 
128  QVariant nmRelationId() const;
129 
135  void setNmRelationId( const QVariant &nmRelationId = QVariant() );
136 
141  QString label() const;
142 
148  void setLabel( const QString &label = QString() );
149 
155  QgsRelation relation() const;
156 
168  void widgetValueChanged( const QString &attribute, const QVariant &newValue, bool attributeChanged );
169 
170 
171  protected:
172  QWidget *createWidget( QWidget *parent ) override;
173  void initWidget( QWidget *editor ) override;
174  bool valid() const override;
175 
176  public slots:
177  void setFeature( const QgsFeature &feature ) override;
178 
184  void setVisible( bool visible );
185 
186  private:
187  void aboutToSave() override;
188  QgsRelation mRelation;
189  QgsRelation mNmRelation;
190  QgsRelationEditorWidget *mWidget = nullptr;
191 };
192 
193 #endif // QGSRELATIONWIDGETWRAPPER_H
QgsWidgetWrapper::initWidget
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
Definition: qgswidgetwrapper.cpp:106
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:53
QgsRelationWidgetWrapper
Definition: qgsrelationwidgetwrapper.h:31
QgsRelationEditorWidget
Definition: qgsrelationeditorwidget.h:84
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
qgis_sip.h
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:387
qgswidgetwrapper.h
QgsRelation
Definition: qgsrelation.h:42
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:56
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsWidgetWrapper::createWidget
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.