Skip to content
Permalink
Browse files

Embedded relref widget: less functionality

  • Loading branch information
m-kuhn committed Dec 13, 2017
1 parent d4ae83f commit b579414c04ad0f7c53b748b39fc759cc205845ad
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp
@@ -35,15 +35,17 @@ QWidget *QgsRelationReferenceWidgetWrapper::createWidget( QWidget *parent )

void QgsRelationReferenceWidgetWrapper::initWidget( QWidget *editor )
{
QgsRelationReferenceWidget *w = dynamic_cast<QgsRelationReferenceWidget *>( editor );
QgsRelationReferenceWidget *w = qobject_cast<QgsRelationReferenceWidget *>( editor );
if ( !w )
{
w = new QgsRelationReferenceWidget( editor );
}

mWidget = w;

mWidget->setEditorContext( context(), mCanvas, mMessageBar );
const QgsAttributeEditorContext *ctx = &context();

mWidget->setEditorContext( *ctx, mCanvas, mMessageBar );

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

// If this widget is already embedded by the same relation, reduce functionality
const QgsAttributeEditorContext *ctx = &context();
do
{
if ( ctx->relation().name() == relation.name() )
{
mWidget->setEmbedForm( false );
mWidget->setReadOnlySelector( false );
mWidget->setReadOnlySelector( true );
mWidget->setAllowMapIdentification( false );
mWidget->setOpenFormButtonVisible( false );
break;
}
ctx = ctx->parentContext();

0 comments on commit b579414

Please sign in to comment.
You can’t perform that action at this time.