Skip to content
Permalink
Browse files

FIX #35196, layer was not set on QgsFieldExpressionWidget

  • Loading branch information
speillet authored and nyalldawson committed May 29, 2020
1 parent c6b7aed commit 834c5ba209f4d9ed4080bf25f828f98a0ee7db4b
@@ -18,7 +18,7 @@
#include "qgsattributesformproperties.h"


QgsAttributeFormContainerEdit::QgsAttributeFormContainerEdit( QTreeWidgetItem *item, QWidget *parent )
QgsAttributeFormContainerEdit::QgsAttributeFormContainerEdit( QTreeWidgetItem *item, QgsVectorLayer *layer, QWidget *parent )
: QWidget( parent )
, mTreeItem( item )
{
@@ -40,6 +40,7 @@ QgsAttributeFormContainerEdit::QgsAttributeFormContainerEdit( QTreeWidgetItem *i
mShowAsGroupBoxCheckBox->setChecked( itemData.showAsGroupBox() );

mControlVisibilityGroupBox->setChecked( itemData.visibilityExpression().enabled() );
mVisibilityExpressionWidget->setLayer( layer );
mVisibilityExpressionWidget->setExpression( itemData.visibilityExpression()->expression() );
mColumnCountSpinBox->setValue( itemData.columnCount() );
mBackgroundColorButton->setColor( itemData.backgroundColor() );
@@ -36,7 +36,7 @@ class GUI_EXPORT QgsAttributeFormContainerEdit: public QWidget, private Ui_QgsAt
Q_OBJECT

public:
explicit QgsAttributeFormContainerEdit( QTreeWidgetItem *item, QWidget *parent = nullptr );
explicit QgsAttributeFormContainerEdit( QTreeWidgetItem *item, QgsVectorLayer *layer, QWidget *parent = nullptr );

/**
* Register an expression context generator class that will be used to retrieve
@@ -438,7 +438,7 @@ void QgsAttributesFormProperties::loadAttributeContainerEdit()
return;

QTreeWidgetItem *currentItem = mFormLayoutTree->selectedItems().at( 0 );
mAttributeContainerEdit = new QgsAttributeFormContainerEdit( currentItem, this );
mAttributeContainerEdit = new QgsAttributeFormContainerEdit( currentItem, mLayer, this );
mAttributeContainerEdit->registerExpressionContextGenerator( this );
mAttributeContainerEdit->layout()->setContentsMargins( 0, 0, 0, 0 );
mAttributeTypeFrame->layout()->setContentsMargins( 0, 0, 0, 0 );

0 comments on commit 834c5ba

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