Skip to content

Commit

Permalink
Embedded relref widget: less functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Dec 13, 2017
1 parent d4ae83f commit b579414
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit b579414

Please sign in to comment.