Skip to content
Permalink
Browse files
[AttributeForm] respect size policy of embedded widgets
This let widgets wich can make use of more vertical space grow
togheter with the form dialog
  • Loading branch information
domi4484 authored and github-actions committed Nov 16, 2021
1 parent 1659096 commit 035a6f56c45404977b090e29bd89b2491b77593f
Showing with 9 additions and 2 deletions.
  1. +5 −1 src/gui/qgsattributeform.cpp
  2. +1 −1 src/gui/qgsattributeformeditorwidget.cpp
  3. +3 −0 src/gui/qgsattributeformwidget.cpp
@@ -1561,6 +1561,7 @@ void QgsAttributeForm::init()
int column = 0;
int columnCount = 1;
bool hasRootFields = false;
bool addSpacer = true;

const QList<QgsAttributeEditorElement *> tabs = mLayer->editFormConfig().tabs();

@@ -1640,6 +1641,9 @@ void QgsAttributeForm::init()

label->setBuddy( widgetInfo.widget );

if ( widgetInfo.widget->sizePolicy().verticalPolicy() != QSizePolicy::Fixed )
addSpacer = false;

if ( !widgetInfo.showLabel )
{
QVBoxLayout *c = new QVBoxLayout();
@@ -1690,7 +1694,7 @@ void QgsAttributeForm::init()
}
}

if ( hasRootFields )
if ( hasRootFields && addSpacer )
{
QSpacerItem *spacerItem = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
layout->addItem( spacerItem, row, 0 );
@@ -46,7 +46,7 @@ QgsAttributeFormEditorWidget::QgsAttributeFormEditorWidget( QgsEditorWidgetWrapp

mMultiEditButton->setField( mEditorWidget->field() );
mAggregateButton = new QgsAggregateToolButton();
mAggregateButton->setType( editorWidget->field().type() );
mAggregateButton->setType( mEditorWidget->field().type() );
connect( mAggregateButton, &QgsAggregateToolButton::aggregateChanged, this, &QgsAttributeFormEditorWidget::onAggregateChanged );

if ( mEditorWidget->widget() )
@@ -60,6 +60,9 @@ QgsAttributeFormWidget::QgsAttributeFormWidget( QgsWidgetWrapper *widget, QgsAtt

mEditPage->layout()->addWidget( mWidget->widget() );

// Respect size policy of embedded widget
setSizePolicy( mWidget->widget()->sizePolicy() );

updateWidgets();
}

0 comments on commit 035a6f5

Please sign in to comment.