QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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  bool showLinkButton() const;
61 
67  void setShowLinkButton( bool showLinkButton );
68 
74  bool showSaveChildEditsButton() const;
75 
81  void setShowSaveChildEditsButton( bool showSaveChildEditsButton );
82 
88  bool showUnlinkButton() const;
89 
95  void setShowUnlinkButton( bool showUnlinkButton );
96 
102  QgsRelation relation() const;
103 
115  void widgetValueChanged( const QString &attribute, const QVariant &newValue, bool attributeChanged );
116 
117 
118  protected:
119  QWidget *createWidget( QWidget *parent ) override;
120  void initWidget( QWidget *editor ) override;
121  bool valid() const override;
122 
123  public slots:
124  void setFeature( const QgsFeature &feature ) override;
125 
131  void setVisible( bool visible );
132 
133  private:
134  void aboutToSave() override;
135  QgsRelation mRelation;
136  QgsRelation mNmRelation;
137  QgsRelationEditorWidget *mWidget = nullptr;
138 };
139 
140 #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
Definition: qgswidgetwrapper.h:52
QgsRelationWidgetWrapper
Definition: qgsrelationwidgetwrapper.h:30
QgsRelationEditorWidget
Definition: qgsrelationeditorwidget.h:83
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
Definition: qgsvectorlayer.h:385
qgswidgetwrapper.h
QgsRelation
Definition: qgsrelation.h:41
QgsFeature
Definition: qgsfeature.h:55
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.