Skip to content

Commit

Permalink
Merge pull request #45703 from domi4484/multieditSupportForRelationEd…
Browse files Browse the repository at this point in the history
…itor

Multiedit support for relation editor
  • Loading branch information
troopa81 committed Nov 23, 2021
2 parents db77eb1 + 555d5d9 commit 6eda6e4
Show file tree
Hide file tree
Showing 16 changed files with 907 additions and 113 deletions.
Expand Up @@ -246,6 +246,15 @@ Forward the signal to the embedded form
virtual void setFeature( const QgsFeature &feature );


void setMultiEditFeatureIds( const QgsFeatureIds &fids );
%Docstring
Set multiple feature to edit simultaneously.

:param fids: Multiple Id of features to edit

.. versionadded:: 3.24
%End

void setVisible( bool visible );
%Docstring
Sets the visibility of the wrapper's widget.
Expand Down
22 changes: 20 additions & 2 deletions python/gui/auto_generated/qgsabstractrelationeditorwidget.sip.in
Expand Up @@ -74,6 +74,15 @@ Returns the nm relation
void setFeature( const QgsFeature &feature, bool update = true );
%Docstring
Sets the ``feature`` being edited and updates the UI unless ``update`` is set to ``False``
%End

void setMultiEditFeatureIds( const QgsFeatureIds &fids );
%Docstring
Set multiple feature to edit simultaneously.

:param fids: Multiple Id of features to edit

.. versionadded:: 3.24
%End

virtual void setEditorContext( const QgsAttributeEditorContext &context );
Expand Down Expand Up @@ -156,6 +165,13 @@ Returns the widget configuration
virtual void setConfig( const QVariantMap &config ) = 0;
%Docstring
Defines the widget configuration
%End

bool multiEditModeActive() const;
%Docstring
Returns true if editing multiple features at a time

.. versionadded:: 3.24
%End

public slots:
Expand All @@ -177,9 +193,11 @@ Toggles editing state of the widget
Saves the current modifications in the relation
%End

void addFeature( const QgsGeometry &geometry = QgsGeometry() );
QgsFeatureIds addFeature( const QgsGeometry &geometry = QgsGeometry() );
%Docstring
Adds a new feature with given ``geometry``
Adds new features with given ``geometry``

.. versionadded:: 3.24
%End

void deleteFeature( QgsFeatureId fid = QgsFeatureId() );
Expand Down
Expand Up @@ -34,6 +34,15 @@ Constructor
virtual QString currentFilterExpression() const;


void setMultiEditFeatureIds( const QgsFeatureIds &fids );
%Docstring
Set multiple feature to edit simultaneously.

:param fids: Multiple Id of features to edit

.. versionadded:: 3.24
%End

};

/************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrelationreferenceconfigdlg.h
@@ -1,5 +1,5 @@
/***************************************************************************
qgsrelationreferenceconfigdlgbase.h
qgsrelationreferenceconfigdlg.h
--------------------------------------
Date : 21.4.2013
Copyright : (C) 2013 Matthias Kuhn
Expand Down
6 changes: 6 additions & 0 deletions src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
Expand Up @@ -59,6 +59,12 @@ void QgsRelationWidgetWrapper::setFeature( const QgsFeature &feature )
mWidget->setFeature( feature );
}

void QgsRelationWidgetWrapper::setMultiEditFeatureIds( const QgsFeatureIds &fids )
{
if ( mWidget && mRelation.isValid() )
mWidget->setMultiEditFeatureIds( fids );
}

void QgsRelationWidgetWrapper::setVisible( bool visible )
{
if ( mWidget )
Expand Down
7 changes: 7 additions & 0 deletions src/gui/editorwidgets/qgsrelationwidgetwrapper.h
Expand Up @@ -213,6 +213,13 @@ class GUI_EXPORT QgsRelationWidgetWrapper : public QgsWidgetWrapper
public slots:
void setFeature( const QgsFeature &feature ) override;

/**
* Set multiple feature to edit simultaneously.
* \param fids Multiple Id of features to edit
* \since QGIS 3.24
*/
void setMultiEditFeatureIds( const QgsFeatureIds &fids );

/**
* Sets the visibility of the wrapper's widget.
* \param visible set to TRUE to show widget, FALSE to hide widget
Expand Down

0 comments on commit 6eda6e4

Please sign in to comment.