Skip to content

Commit b579414

Browse files
committed
Embedded relref widget: less functionality
1 parent d4ae83f commit b579414

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ QWidget *QgsRelationReferenceWidgetWrapper::createWidget( QWidget *parent )
3535

3636
void QgsRelationReferenceWidgetWrapper::initWidget( QWidget *editor )
3737
{
38-
QgsRelationReferenceWidget *w = dynamic_cast<QgsRelationReferenceWidget *>( editor );
38+
QgsRelationReferenceWidget *w = qobject_cast<QgsRelationReferenceWidget *>( editor );
3939
if ( !w )
4040
{
4141
w = new QgsRelationReferenceWidget( editor );
4242
}
4343

4444
mWidget = w;
4545

46-
mWidget->setEditorContext( context(), mCanvas, mMessageBar );
46+
const QgsAttributeEditorContext *ctx = &context();
47+
48+
mWidget->setEditorContext( *ctx, mCanvas, mMessageBar );
4749

4850
bool showForm = config( QStringLiteral( "ShowForm" ), false ).toBool();
4951
bool mapIdent = config( QStringLiteral( "MapIdentification" ), false ).toBool();
@@ -72,14 +74,14 @@ void QgsRelationReferenceWidgetWrapper::initWidget( QWidget *editor )
7274
relation = layer()->referencingRelations( fieldIdx() )[0];
7375

7476
// If this widget is already embedded by the same relation, reduce functionality
75-
const QgsAttributeEditorContext *ctx = &context();
7677
do
7778
{
7879
if ( ctx->relation().name() == relation.name() )
7980
{
8081
mWidget->setEmbedForm( false );
81-
mWidget->setReadOnlySelector( false );
82+
mWidget->setReadOnlySelector( true );
8283
mWidget->setAllowMapIdentification( false );
84+
mWidget->setOpenFormButtonVisible( false );
8385
break;
8486
}
8587
ctx = ctx->parentContext();

0 commit comments

Comments
 (0)