QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
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 "qgis_gui.h"
20#include "qgis_sip.h"
22#include "qgswidgetwrapper.h"
23
25
32{
33 Q_OBJECT
34
35 public:
37 QgsRelationWidgetWrapper( QgsVectorLayer *vl, const QgsRelation &relation, QWidget *editor SIP_CONSTRAINED = nullptr, QWidget *parent SIP_TRANSFERTHIS SIP_CONSTRAINED = nullptr );
38
40 QgsRelationWidgetWrapper( const QString &relationEditorName, QgsVectorLayer *vl, const QgsRelation &relation, QWidget *editor = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
41
48 Q_DECL_DEPRECATED bool showLabel() const SIP_DEPRECATED;
49
56 Q_DECL_DEPRECATED void setShowLabel( bool showLabel ) SIP_DEPRECATED;
57
62 Q_DECL_DEPRECATED bool showLinkButton() const SIP_DEPRECATED;
63
68 Q_DECL_DEPRECATED void setShowLinkButton( bool showLinkButton ) SIP_DEPRECATED;
69
74 Q_DECL_DEPRECATED bool showUnlinkButton() const SIP_DEPRECATED;
75
80 Q_DECL_DEPRECATED void setShowUnlinkButton( bool showUnlinkButton ) SIP_DEPRECATED;
81
87 Q_DECL_DEPRECATED void setShowSaveChildEditsButton( bool showChildEdits ) SIP_DEPRECATED;
88
94 Q_DECL_DEPRECATED bool showSaveChildEditsButton() const SIP_DEPRECATED;
95
101 Q_DECL_DEPRECATED void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons ) SIP_DEPRECATED;
102
109
110
117 void setWidgetConfig( const QVariantMap &config );
118
123 QVariantMap widgetConfig() const;
124
129 bool forceSuppressFormPopup() const;
130
139
144 QVariant nmRelationId() const;
145
151 void setNmRelationId( const QVariant &nmRelationId = QVariant() );
152
158 Q_DECL_DEPRECATED QString label() const SIP_DEPRECATED;
159
166 Q_DECL_DEPRECATED void setLabel( const QString &label = QString() ) SIP_DEPRECATED;
167
172 QgsRelation relation() const;
173
185 void widgetValueChanged( const QString &attribute, const QVariant &newValue, bool attributeChanged );
186
187
188 protected:
189 QWidget *createWidget( QWidget *parent ) override;
190 void initWidget( QWidget *editor ) override;
191 bool valid() const override;
192
193 signals:
194
203
204 public slots:
205 void setFeature( const QgsFeature &feature ) override;
206
212 void setMultiEditFeatureIds( const QgsFeatureIds &fids );
213
218 void setVisible( bool visible );
219
220 private:
221 void aboutToSave() override;
222 QgsRelation mRelation;
223 QgsRelation mNmRelation;
224 QString mRelationEditorId;
225 QgsAbstractRelationEditorWidget *mWidget = nullptr;
226};
227
228#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:60
void relatedFeaturesChanged()
Emit this signal, whenever the related features changed.
Q_DECL_DEPRECATED bool showLabel() const
Defines if a title label should be shown for this widget.
void setVisible(bool visible)
Sets the visibility of the wrapper's widget.
Q_DECL_DEPRECATED void setVisibleButtons(const QgsAttributeEditorRelation::Buttons &buttons)
Defines the buttons which are shown.
QgsRelation relation() const
The relation for which this wrapper is created.
QVariantMap widgetConfig() const
Returns the whole widget config.
Q_DECL_DEPRECATED void setShowLabel(bool showLabel)
Defines if a title label should be shown for this widget.
Q_DECL_DEPRECATED void setLabel(const QString &label=QString())
Sets label for this element If it's empty it takes the relation id as label.
void setWidgetConfig(const QVariantMap &config)
Will set the config of this widget wrapper to the specified config.
void widgetValueChanged(const QString &attribute, const QVariant &newValue, bool attributeChanged)
Will be called when a value in the current edited form or table row changes.
void setForceSuppressFormPopup(bool forceSuppressFormPopup)
Sets force suppress form popup status to forceSuppressFormPopup for this widget and for the vectorLay...
Q_DECL_DEPRECATED bool showLinkButton() const
Determines if the "link feature" button should be shown.
Q_DECL_DEPRECATED bool showUnlinkButton() const
Determines if the "unlink feature" button should be shown.
bool forceSuppressFormPopup() const
Determines the force suppress form popup status that is configured for this widget.
void setMultiEditFeatureIds(const QgsFeatureIds &fids)
Set multiple feature to edit simultaneously.
Q_DECL_DEPRECATED void setShowUnlinkButton(bool showUnlinkButton)
Determines if the "unlink feature" button should be shown.
Q_DECL_DEPRECATED QgsAttributeEditorRelation::Buttons visibleButtons() const
Returns the buttons which are shown.
QgsRelationWidgetWrapper(QgsVectorLayer *vl, const QgsRelation &relation, QWidget *editor=nullptr, QWidget *parent=nullptr)
Constructor for QgsRelationWidgetWrapper.
Q_DECL_DEPRECATED QString label() const
Determines the label of this element.
void setNmRelationId(const QVariant &nmRelationId=QVariant())
Sets nmRelationId for the relation id of the second relation involved in an N:M relation.
QVariant nmRelationId() const
Determines the relation id of the second relation involved in an N:M relation.
Q_DECL_DEPRECATED bool showSaveChildEditsButton() const
Determines if the "Save child layer edits" button should be shown.
Q_DECL_DEPRECATED void setShowSaveChildEditsButton(bool showChildEdits)
Determines if the "Save child layer edits" button should be shown.
Q_DECL_DEPRECATED void setShowLinkButton(bool showLinkButton)
Determines if the "link feature" button should be shown.
Represents a relationship between two vector layers.
Definition qgsrelation.h:42
Represents a vector layer which manages a vector based dataset.
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.
QVariant config(const QString &key, const QVariant &defaultVal=QVariant()) const
Use this inside your overridden classes to access the configuration.
QgsWidgetWrapper(QgsVectorLayer *vl, QWidget *editor=nullptr, QWidget *parent=nullptr)
Create a new widget wrapper.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_CONSTRAINED
Definition qgis_sip.h:118
QSet< QgsFeatureId > QgsFeatureIds