@@ -35,15 +35,17 @@ QWidget *QgsRelationReferenceWidgetWrapper::createWidget( QWidget *parent )
35
35
36
36
void QgsRelationReferenceWidgetWrapper::initWidget ( QWidget *editor )
37
37
{
38
- QgsRelationReferenceWidget *w = dynamic_cast <QgsRelationReferenceWidget *>( editor );
38
+ QgsRelationReferenceWidget *w = qobject_cast <QgsRelationReferenceWidget *>( editor );
39
39
if ( !w )
40
40
{
41
41
w = new QgsRelationReferenceWidget ( editor );
42
42
}
43
43
44
44
mWidget = w;
45
45
46
- mWidget ->setEditorContext ( context (), mCanvas , mMessageBar );
46
+ const QgsAttributeEditorContext *ctx = &context ();
47
+
48
+ mWidget ->setEditorContext ( *ctx, mCanvas , mMessageBar );
47
49
48
50
bool showForm = config ( QStringLiteral ( " ShowForm" ), false ).toBool ();
49
51
bool mapIdent = config ( QStringLiteral ( " MapIdentification" ), false ).toBool ();
@@ -72,14 +74,14 @@ void QgsRelationReferenceWidgetWrapper::initWidget( QWidget *editor )
72
74
relation = layer ()->referencingRelations ( fieldIdx () )[0 ];
73
75
74
76
// If this widget is already embedded by the same relation, reduce functionality
75
- const QgsAttributeEditorContext *ctx = &context ();
76
77
do
77
78
{
78
79
if ( ctx->relation ().name () == relation .name () )
79
80
{
80
81
mWidget ->setEmbedForm ( false );
81
- mWidget ->setReadOnlySelector ( false );
82
+ mWidget ->setReadOnlySelector ( true );
82
83
mWidget ->setAllowMapIdentification ( false );
84
+ mWidget ->setOpenFormButtonVisible ( false );
83
85
break ;
84
86
}
85
87
ctx = ctx->parentContext ();
0 commit comments