Skip to content

Commit

Permalink
Relation editor wdgs: fix ok/cancel button when embedded
Browse files Browse the repository at this point in the history
Ok/Cancel button were shown even when embedded (followup #34827 )

Also add accessor for editorContext.
  • Loading branch information
elpaso authored and nyalldawson committed Mar 31, 2020
1 parent eb1ebcd commit 96bd689
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions python/gui/auto_generated/qgsrelationeditorwidget.sip.in
Expand Up @@ -81,6 +81,13 @@ Sets the editor ``context``
the geometry of a referencing feature from this widget
%End

QgsAttributeEditorContext editorContext( );
%Docstring
Returns the editor ``context``

.. versionadded:: 3.14
%End

QgsIFeatureSelectionManager *featureSelectionManager();
%Docstring
The feature selection manager is responsible for the selected features
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
Expand Up @@ -90,7 +90,7 @@ void QgsRelationWidgetWrapper::widgetValueChanged( const QString &attribute, con
if ( feature.attribute( attribute ) != newValue )
{
feature.setAttribute( attribute, newValue );
QgsAttributeEditorContext newContext { context() };
QgsAttributeEditorContext newContext { mWidget->editorContext() };
newContext.setParentFormFeature( feature );
mWidget->setEditorContext( newContext );
mWidget->setFeature( feature, false );
Expand Down
5 changes: 5 additions & 0 deletions src/gui/qgsrelationeditorwidget.cpp
Expand Up @@ -376,6 +376,11 @@ void QgsRelationEditorWidget::setEditorContext( const QgsAttributeEditorContext
}
}

QgsAttributeEditorContext QgsRelationEditorWidget::editorContext()
{
return mEditorContext;
}

QgsIFeatureSelectionManager *QgsRelationEditorWidget::featureSelectionManager()
{
return mFeatureSelectionMgr;
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsrelationeditorwidget.h
Expand Up @@ -139,6 +139,12 @@ class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox
*/
void setEditorContext( const QgsAttributeEditorContext &context );

/**
* Returns the editor \a context
* \since QGIS 3.14
*/
QgsAttributeEditorContext editorContext( );

/**
* The feature selection manager is responsible for the selected features
* which are currently being edited.
Expand Down

0 comments on commit 96bd689

Please sign in to comment.