QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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:
39 const QgsRelation &relation,
40 QWidget *editor SIP_CONSTRAINED = nullptr,
41 QWidget *parent SIP_TRANSFERTHIS SIP_CONSTRAINED = nullptr
42 );
43
46 const QString &relationEditorName,
48 const QgsRelation &relation,
49 QWidget *editor = nullptr,
50 QWidget *parent SIP_TRANSFERTHIS = nullptr
51 );
52
59 Q_DECL_DEPRECATED bool showLabel() const SIP_DEPRECATED;
60
67 Q_DECL_DEPRECATED void setShowLabel( bool showLabel ) SIP_DEPRECATED;
68
73 Q_DECL_DEPRECATED bool showLinkButton() const SIP_DEPRECATED;
74
79 Q_DECL_DEPRECATED void setShowLinkButton( bool showLinkButton ) SIP_DEPRECATED;
80
85 Q_DECL_DEPRECATED bool showUnlinkButton() const SIP_DEPRECATED;
86
91 Q_DECL_DEPRECATED void setShowUnlinkButton( bool showUnlinkButton ) SIP_DEPRECATED;
92
98 Q_DECL_DEPRECATED void setShowSaveChildEditsButton( bool showChildEdits ) SIP_DEPRECATED;
99
105 Q_DECL_DEPRECATED bool showSaveChildEditsButton() const SIP_DEPRECATED;
106
112 Q_DECL_DEPRECATED void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons ) SIP_DEPRECATED;
113
120
121
128 void setWidgetConfig( const QVariantMap &config );
129
134 QVariantMap widgetConfig() const;
135
140 bool forceSuppressFormPopup() const;
141
150
155 QVariant nmRelationId() const;
156
162 void setNmRelationId( const QVariant &nmRelationId = QVariant() );
163
169 Q_DECL_DEPRECATED QString label() const SIP_DEPRECATED;
170
177 Q_DECL_DEPRECATED void setLabel( const QString &label = QString() ) SIP_DEPRECATED;
178
183 QgsRelation relation() const;
184
196 void widgetValueChanged( const QString &attribute, const QVariant &newValue, bool attributeChanged );
197
198
199 protected:
200 QWidget *createWidget( QWidget *parent ) override;
201 void initWidget( QWidget *editor ) override;
202 bool valid() const override;
203
204 signals:
205
214
215 public slots:
216 void setFeature( const QgsFeature &feature ) override;
217
223 void setMultiEditFeatureIds( const QgsFeatureIds &fids );
224
229 void setVisible( bool visible );
230
231 private:
232 void aboutToSave() override;
233 QgsRelation mRelation;
234 QgsRelation mNmRelation;
235 QString mRelationEditorId;
236 QgsAbstractRelationEditorWidget *mWidget = nullptr;
237};
238
239#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:58
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:114
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_CONSTRAINED
Definition qgis_sip.h:119
QSet< QgsFeatureId > QgsFeatureIds