Skip to content

Commit 7bcc935

Browse files
committedNov 23, 2015
Fix layout problems with relation reference widget
1 parent 675da0c commit 7bcc935

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed
 

‎src/gui/editorwidgets/qgsrelationreferencewidget.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
8383
{
8484
mTopLayout = new QVBoxLayout( this );
8585
mTopLayout->setContentsMargins( 0, 0, 0, 0 );
86-
mTopLayout->setAlignment( Qt::AlignTop );
86+
87+
setSizePolicy( sizePolicy().horizontalPolicy(), QSizePolicy::Fixed );
88+
8789
setLayout( mTopLayout );
8890

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

145-
// spacer
146-
editLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding ) );
147-
148147
// add line to top layout
149148
mTopLayout->addLayout( editLayout );
150149

@@ -379,6 +378,12 @@ void QgsRelationReferenceWidget::setEditorContext( const QgsAttributeEditorConte
379378

380379
void QgsRelationReferenceWidget::setEmbedForm( bool display )
381380
{
381+
if ( display )
382+
{
383+
setSizePolicy( sizePolicy().horizontalPolicy(), QSizePolicy::MinimumExpanding );
384+
mTopLayout->setAlignment( Qt::AlignTop );
385+
}
386+
382387
mAttributeEditorFrame->setVisible( display );
383388
mEmbedForm = display;
384389
}
@@ -484,6 +489,10 @@ void QgsRelationReferenceWidget::init()
484489
}
485490
}
486491
}
492+
else
493+
{
494+
mFilterContainer->hide();
495+
}
487496

488497
QgsExpression exp( mReferencedLayer->displayExpression() );
489498

‎src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ QgsRelationReferenceWidgetWrapper::QgsRelationReferenceWidgetWrapper( QgsVectorL
3030
QWidget* QgsRelationReferenceWidgetWrapper::createWidget( QWidget* parent )
3131
{
3232
QgsRelationReferenceWidget* w = new QgsRelationReferenceWidget( parent );
33-
w->setSizePolicy( w->sizePolicy().horizontalPolicy(), QSizePolicy::Expanding );
3433
return w;
3534
}
3635

0 commit comments

Comments
 (0)
Please sign in to comment.