Skip to content

Commit

Permalink
Fix layout problems with relation reference widget
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 23, 2015
1 parent 675da0c commit 7bcc935
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 13 additions & 4 deletions src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -83,7 +83,9 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
{
mTopLayout = new QVBoxLayout( this );
mTopLayout->setContentsMargins( 0, 0, 0, 0 );
mTopLayout->setAlignment( Qt::AlignTop );

setSizePolicy( sizePolicy().horizontalPolicy(), QSizePolicy::Fixed );

setLayout( mTopLayout );

QHBoxLayout* editLayout = new QHBoxLayout();
Expand Down Expand Up @@ -142,9 +144,6 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
mRemoveFKButton->setText( tr( "No selection" ) );
editLayout->addWidget( mRemoveFKButton );

// spacer
editLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding ) );

// add line to top layout
mTopLayout->addLayout( editLayout );

Expand Down Expand Up @@ -379,6 +378,12 @@ void QgsRelationReferenceWidget::setEditorContext( const QgsAttributeEditorConte

void QgsRelationReferenceWidget::setEmbedForm( bool display )
{
if ( display )
{
setSizePolicy( sizePolicy().horizontalPolicy(), QSizePolicy::MinimumExpanding );
mTopLayout->setAlignment( Qt::AlignTop );
}

mAttributeEditorFrame->setVisible( display );
mEmbedForm = display;
}
Expand Down Expand Up @@ -484,6 +489,10 @@ void QgsRelationReferenceWidget::init()
}
}
}
else
{
mFilterContainer->hide();
}

QgsExpression exp( mReferencedLayer->displayExpression() );

Expand Down
Expand Up @@ -30,7 +30,6 @@ QgsRelationReferenceWidgetWrapper::QgsRelationReferenceWidgetWrapper( QgsVectorL
QWidget* QgsRelationReferenceWidgetWrapper::createWidget( QWidget* parent )
{
QgsRelationReferenceWidget* w = new QgsRelationReferenceWidget( parent );
w->setSizePolicy( w->sizePolicy().horizontalPolicy(), QSizePolicy::Expanding );
return w;
}

Expand Down

0 comments on commit 7bcc935

Please sign in to comment.