@@ -46,6 +46,17 @@ void QgsRelationWidgetWrapper::setVisible( bool visible )
4646 mWidget ->setVisible ( visible );
4747}
4848
49+ void QgsRelationWidgetWrapper::aboutToSave ()
50+ {
51+ // Calling isModified() will emit a beforeModifiedCheck()
52+ // signal that will make the embedded form to send any
53+ // outstanding widget changes to the edit buffer
54+ mRelation .referencingLayer ()->isModified ();
55+
56+ if ( mNmRelation .isValid () )
57+ mNmRelation .referencedLayer ()->isModified ();
58+ }
59+
4960QgsRelation QgsRelationWidgetWrapper::relation () const
5061{
5162 return mRelation ;
@@ -96,14 +107,14 @@ void QgsRelationWidgetWrapper::initWidget( QWidget *editor )
96107
97108 w->setEditorContext ( myContext );
98109
99- QgsRelation nmrel = QgsProject::instance ()->relationManager ()->relation ( config ( QStringLiteral ( " nm-rel" ) ).toString () );
110+ mNmRelation = QgsProject::instance ()->relationManager ()->relation ( config ( QStringLiteral ( " nm-rel" ) ).toString () );
100111
101112 // If this widget is already embedded by the same relation, reduce functionality
102113 const QgsAttributeEditorContext *ctx = &context ();
103114 do
104115 {
105116 if ( ( ctx->relation ().name () == mRelation .name () && ctx->formMode () == QgsAttributeEditorContext::Embed )
106- || ( nmrel .isValid () && ctx->relation ().name () == nmrel .name () ) )
117+ || ( mNmRelation .isValid () && ctx->relation ().name () == mNmRelation .name () ) )
107118 {
108119 w->setVisible ( false );
109120 break ;
@@ -113,7 +124,7 @@ void QgsRelationWidgetWrapper::initWidget( QWidget *editor )
113124 while ( ctx );
114125
115126
116- w->setRelations ( mRelation , nmrel );
127+ w->setRelations ( mRelation , mNmRelation );
117128
118129 mWidget = w;
119130}
0 commit comments