QGIS API Documentation 3.41.0-Master (3291e9ff48b)
|
Base class to build new relation widgets. More...
#include <qgsabstractrelationeditorwidget.h>
Public Slots | |
virtual void | parentFormValueChanged (const QString &attribute, const QVariant &newValue)=0 |
Called when an attribute value in the parent widget has changed to newValue. | |
Signals | |
void | relatedFeaturesChanged () |
Emit this signal, whenever the related features changed. | |
Public Member Functions | |
QgsAbstractRelationEditorWidget (const QVariantMap &config, QWidget *parent=nullptr) | |
Constructor. | |
virtual QVariantMap | config () const =0 |
Returns the widget configuration. | |
QgsAttributeEditorContext | editorContext () const |
Returns the attribute editor context. | |
QgsFeature | feature () const |
Returns the widget's current feature If the widget is in multiedit mode only the first is returned. | |
QList< QgsFeature > | features () const |
Returns the widget's current features. | |
bool | forceSuppressFormPopup () const |
Determines the force suppress form popup status that is configured for this widget. | |
Q_DECL_DEPRECATED QString | label () const |
Determines the label of this element. | |
bool | multiEditModeActive () const |
Returns true if editing multiple features at a time. | |
QgsRelation | nmRelation () const |
Returns the nm relation. | |
QVariant | nmRelationId () const |
Determines the relation id of the second relation involved in an N:M relation. | |
QgsRelation | relation () const |
Returns the relation. | |
virtual void | setConfig (const QVariantMap &config)=0 |
Defines the widget configuration. | |
virtual void | setEditorContext (const QgsAttributeEditorContext &context) |
Sets the editor context. | |
void | setFeature (const QgsFeature &feature, bool update=true) |
Sets the feature being edited and updates the UI unless update is set to false . | |
void | setForceSuppressFormPopup (bool forceSuppressFormPopup) |
Sets force suppress form popup status with forceSuppressFormPopup configured for this widget. | |
void | setLabel (const QString &label=QString()) |
Sets label for this element If it's empty it takes the relation id as label. | |
void | setMultiEditFeatureIds (const QgsFeatureIds &fids) |
Set multiple feature to edit simultaneously. | |
void | setNmRelationId (const QVariant &nmRelationId=QVariant()) |
Sets nmRelationId for the relation id of the second relation involved in an N:M relation. | |
void | setRelationFeature (const QgsRelation &relation, const QgsFeature &feature) |
Sets the relation and the feature. | |
void | setRelations (const QgsRelation &relation, const QgsRelation &nmrelation) |
Sets the relation(s) for this widget If only one relation is set, it will act as a simple 1:N relation widget If both relations are set, it will act as an N:M relation widget inserting and deleting entries on the intermediate table as required. | |
Q_DECL_DEPRECATED void | setShowLabel (bool showLabel) |
Defines if a title label should be shown for this widget. | |
Q_DECL_DEPRECATED bool | showLabel () const |
Defines if a title label should be shown for this widget. | |
Protected Slots | |
QgsFeatureIds | addFeature (const QgsGeometry &geometry=QgsGeometry()) |
Adds new features with given geometry Returns the Id of added features. | |
void | deleteFeature (QgsFeatureId fid=QgsFeatureId()) |
Delete a feature with given fid. | |
void | duplicateFeature (const QgsFeatureId &fid) |
Duplicates a feature. | |
void | duplicateFeatures (const QgsFeatureIds &fids) |
Duplicates features. | |
void | linkFeature (const QString &filterExpression=QString()) |
Links a new feature to the relation. | |
void | onLinkFeatureDlgAccepted () |
Called when the link feature dialog is confirmed by the user. | |
void | saveEdits () |
Saves the current modifications in the relation. | |
void | toggleEditing (bool state) |
Toggles editing state of the widget. | |
void | unlinkFeature (QgsFeatureId fid=QgsFeatureId()) |
Unlinks a feature with given fid. | |
Protected Member Functions | |
virtual void | afterSetRelationFeature () |
A hook called right after setRelationFeature() is executed, but before updateUi() is called. | |
virtual void | afterSetRelations () |
A hook called right after setRelations() is executed, but before updateUi() is called. | |
virtual void | beforeSetRelationFeature (const QgsRelation &newRelation, const QgsFeature &newFeature) |
A hook called right before setRelationFeature() is executed. | |
virtual void | beforeSetRelations (const QgsRelation &newRelation, const QgsRelation &newNmRelation) |
A hook called right before setRelations() is executed. | |
void | deleteFeatures (const QgsFeatureIds &fids) |
Deletes the features with fids. | |
virtual Q_DECL_DEPRECATED void | setTitle (const QString &title) |
Sets the title of the widget, if it is wrapped within a QgsCollapsibleGroupBox. | |
void | showEvent (QShowEvent *) |
Refresh the UI when the widget becomes visible. | |
void | unlinkFeatures (const QgsFeatureIds &fids) |
Unlinks the features with fids. | |
Q_DECL_DEPRECATED void | updateTitle () |
Updates the title contents to reflect the current state of the widget. | |
virtual void | updateUi () |
A hook called every time the state of the relation editor widget has changed via calling its set* methods or slots, e.g. | |
Protected Attributes | |
QgsAttributeEditorContext | mEditorContext |
QgsFeatureList | mFeatureList |
bool | mForceSuppressFormPopup = false |
bool | mLayerInSameTransactionGroup = false |
QgsRelation | mNmRelation |
QgsRelation | mRelation |
Base class to build new relation widgets.
Definition at line 45 of file qgsabstractrelationeditorwidget.h.
QgsAbstractRelationEditorWidget::QgsAbstractRelationEditorWidget | ( | const QVariantMap & | config, |
QWidget * | parent = nullptr |
||
) |
Constructor.
Definition at line 37 of file qgsabstractrelationeditorwidget.cpp.
|
protectedslot |
Adds new features with given geometry Returns the Id of added features.
Definition at line 220 of file qgsabstractrelationeditorwidget.cpp.
|
protectedvirtual |
A hook called right after setRelationFeature() is executed, but before updateUi() is called.
Used to update the UI once setting the relation feature is done. Check QgsRealationEditorWidget as an example.
Reimplemented in QgsRelationEditorWidget.
Definition at line 723 of file qgsabstractrelationeditorwidget.cpp.
|
protectedvirtual |
A hook called right after setRelations() is executed, but before updateUi() is called.
Used to update the UI once setting the relations is done. Check QgsRealationEditorWidget as an example.
Reimplemented in QgsRelationEditorWidget.
Definition at line 732 of file qgsabstractrelationeditorwidget.cpp.
|
protectedvirtual |
A hook called right before setRelationFeature() is executed.
Used to update the UI once setting the relation feature is done. Check QgsRealationEditorWidget as an example.
Reimplemented in QgsRelationEditorWidget.
Definition at line 717 of file qgsabstractrelationeditorwidget.cpp.
|
protectedvirtual |
A hook called right before setRelations() is executed.
Used to manipulate UI once setting the relations is done. Check QgsRealationEditorWidget as an example.
Reimplemented in QgsRelationEditorWidget.
Definition at line 726 of file qgsabstractrelationeditorwidget.cpp.
|
pure virtual |
Returns the widget configuration.
Implemented in QgsRelationEditorWidget.
|
protectedslot |
Delete a feature with given fid.
Definition at line 325 of file qgsabstractrelationeditorwidget.cpp.
|
protected |
Deletes the features with fids.
Definition at line 332 of file qgsabstractrelationeditorwidget.cpp.
|
protectedslot |
Duplicates a feature.
Definition at line 735 of file qgsabstractrelationeditorwidget.cpp.
|
protectedslot |
Duplicates features.
Definition at line 742 of file qgsabstractrelationeditorwidget.cpp.
QgsAttributeEditorContext QgsAbstractRelationEditorWidget::editorContext | ( | ) | const |
Returns the attribute editor context.
Definition at line 102 of file qgsabstractrelationeditorwidget.cpp.
QgsFeature QgsAbstractRelationEditorWidget::feature | ( | ) | const |
Returns the widget's current feature If the widget is in multiedit mode only the first is returned.
Definition at line 184 of file qgsabstractrelationeditorwidget.cpp.
QList< QgsFeature > QgsAbstractRelationEditorWidget::features | ( | ) | const |
Returns the widget's current features.
Definition at line 192 of file qgsabstractrelationeditorwidget.cpp.
bool QgsAbstractRelationEditorWidget::forceSuppressFormPopup | ( | ) | const |
Determines the force suppress form popup status that is configured for this widget.
Definition at line 170 of file qgsabstractrelationeditorwidget.cpp.
QString QgsAbstractRelationEditorWidget::label | ( | ) | const |
Determines the label of this element.
Definition at line 145 of file qgsabstractrelationeditorwidget.cpp.
|
protectedslot |
Links a new feature to the relation.
filterExpression | to filter the available features in the link dialog since QGIS 3.40 |
Definition at line 452 of file qgsabstractrelationeditorwidget.cpp.
bool QgsAbstractRelationEditorWidget::multiEditModeActive | ( | ) | const |
Returns true if editing multiple features at a time.
Definition at line 179 of file qgsabstractrelationeditorwidget.cpp.
|
inline |
Returns the nm relation.
Definition at line 93 of file qgsabstractrelationeditorwidget.h.
QVariant QgsAbstractRelationEditorWidget::nmRelationId | ( | ) | const |
Determines the relation id of the second relation involved in an N:M relation.
Definition at line 140 of file qgsabstractrelationeditorwidget.cpp.
|
protectedslot |
Called when the link feature dialog is confirmed by the user.
Definition at line 485 of file qgsabstractrelationeditorwidget.cpp.
|
pure virtualslot |
Called when an attribute value in the parent widget has changed to newValue.
|
signal |
Emit this signal, whenever the related features changed.
This happens for example when related features are added, removed, linked or unlinked.
|
inline |
Returns the relation.
Definition at line 87 of file qgsabstractrelationeditorwidget.h.
|
protectedslot |
Saves the current modifications in the relation.
Definition at line 213 of file qgsabstractrelationeditorwidget.cpp.
|
pure virtual |
Defines the widget configuration.
Implemented in QgsRelationEditorWidget.
|
virtual |
Sets the editor context.
Reimplemented in QgsRelationEditorWidget.
Definition at line 97 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setFeature | ( | const QgsFeature & | feature, |
bool | update = true |
||
) |
Sets the feature being edited and updates the UI unless update is set to false
.
Definition at line 107 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setForceSuppressFormPopup | ( | bool | forceSuppressFormPopup | ) |
Sets force suppress form popup status with forceSuppressFormPopup configured for this widget.
Definition at line 165 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setLabel | ( | const QString & | label = QString() | ) |
Sets label for this element If it's empty it takes the relation id as label.
Definition at line 150 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setMultiEditFeatureIds | ( | const QgsFeatureIds & | fids | ) |
Set multiple feature to edit simultaneously.
fids | Multiple Id of features to edit |
Definition at line 118 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setNmRelationId | ( | const QVariant & | nmRelationId = QVariant() | ) |
Sets nmRelationId for the relation id of the second relation involved in an N:M relation.
If it's empty, then it's considered as a 1:M relationship.
Definition at line 131 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setRelationFeature | ( | const QgsRelation & | relation, |
const QgsFeature & | feature | ||
) |
Sets the relation and the feature.
Definition at line 43 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setRelations | ( | const QgsRelation & | relation, |
const QgsRelation & | nmrelation | ||
) |
Sets the relation(s) for this widget If only one relation is set, it will act as a simple 1:N relation widget If both relations are set, it will act as an N:M relation widget inserting and deleting entries on the intermediate table as required.
relation | Relation referencing the edited table |
nmrelation | Optional reference from the referencing table to a 3rd N:M table |
Definition at line 57 of file qgsabstractrelationeditorwidget.cpp.
void QgsAbstractRelationEditorWidget::setShowLabel | ( | bool | showLabel | ) |
Defines if a title label should be shown for this widget.
Definition at line 160 of file qgsabstractrelationeditorwidget.cpp.
|
protectedvirtual |
Sets the title of the widget, if it is wrapped within a QgsCollapsibleGroupBox.
Definition at line 712 of file qgsabstractrelationeditorwidget.cpp.
|
protected |
Refresh the UI when the widget becomes visible.
Definition at line 757 of file qgsabstractrelationeditorwidget.cpp.
bool QgsAbstractRelationEditorWidget::showLabel | ( | ) | const |
Defines if a title label should be shown for this widget.
Definition at line 155 of file qgsabstractrelationeditorwidget.cpp.
|
protectedslot |
Toggles editing state of the widget.
Definition at line 197 of file qgsabstractrelationeditorwidget.cpp.
|
protectedslot |
Unlinks a feature with given fid.
Definition at line 608 of file qgsabstractrelationeditorwidget.cpp.
|
protected |
Unlinks the features with fids.
Definition at line 613 of file qgsabstractrelationeditorwidget.cpp.
|
protected |
Updates the title contents to reflect the current state of the widget.
Definition at line 175 of file qgsabstractrelationeditorwidget.cpp.
|
protectedvirtual |
A hook called every time the state of the relation editor widget has changed via calling its set*
methods or slots, e.g.
changed relation, added feature, etc. Should be used to refresh the UI regarding the new data. Check QgsRealationEditorWidget as an example.
Reimplemented in QgsRelationEditorWidget.
Definition at line 709 of file qgsabstractrelationeditorwidget.cpp.
|
protected |
Definition at line 263 of file qgsabstractrelationeditorwidget.h.
|
protected |
Definition at line 266 of file qgsabstractrelationeditorwidget.h.
|
protected |
Definition at line 270 of file qgsabstractrelationeditorwidget.h.
|
protected |
Definition at line 268 of file qgsabstractrelationeditorwidget.h.
|
protected |
Definition at line 265 of file qgsabstractrelationeditorwidget.h.
|
protected |
Definition at line 264 of file qgsabstractrelationeditorwidget.h.