mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
update container visibilty on mode change
This commit is contained in:
parent
4da6e6975a
commit
05b1e83932
@ -77,9 +77,9 @@ QgsAttributeForm::QgsAttributeForm( QgsVectorLayer *vl, const QgsFeature &featur
|
||||
connect( vl, &QgsVectorLayer::beforeAddingExpressionField, this, &QgsAttributeForm::preventFeatureRefresh );
|
||||
connect( vl, &QgsVectorLayer::beforeRemovingExpressionField, this, &QgsAttributeForm::preventFeatureRefresh );
|
||||
connect( vl, &QgsVectorLayer::selectionChanged, this, &QgsAttributeForm::layerSelectionChanged );
|
||||
connect( this, &QgsAttributeForm::modeChanged, this, &QgsAttributeForm::updateContainersVisibility );
|
||||
|
||||
// constraints management
|
||||
updateAllConstraints();
|
||||
updateContainersVisibility();
|
||||
}
|
||||
|
||||
QgsAttributeForm::~QgsAttributeForm()
|
||||
@ -823,6 +823,7 @@ void QgsAttributeForm::updateConstraints( QgsEditorWidgetWrapper *eww )
|
||||
synchronizeEnabledState();
|
||||
|
||||
mExpressionContext.setFeature( ft );
|
||||
|
||||
mExpressionContext << QgsExpressionContextUtils::formScope( ft, modeString( mMode ) );
|
||||
|
||||
// Recheck visibility for all containers which are controlled by this value
|
||||
@ -834,6 +835,22 @@ void QgsAttributeForm::updateConstraints( QgsEditorWidgetWrapper *eww )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsAttributeForm::updateContainersVisibility()
|
||||
{
|
||||
|
||||
mExpressionContext << QgsExpressionContextUtils::formScope( QgsFeature( mFeature ), modeString( mMode ) );
|
||||
|
||||
const QVector<ContainerInformation *> infos = mContainerVisibilityInformation;
|
||||
|
||||
for ( ContainerInformation *info : infos )
|
||||
{
|
||||
info->apply( &mExpressionContext );
|
||||
}
|
||||
|
||||
//and update the constraints
|
||||
updateAllConstraints();
|
||||
}
|
||||
|
||||
void QgsAttributeForm::updateConstraint( const QgsFeature &ft, QgsEditorWidgetWrapper *eww )
|
||||
{
|
||||
QgsFieldConstraints::ConstraintOrigin constraintOrigin = mLayer->isEditable() ? QgsFieldConstraints::ConstraintOriginNotSet : QgsFieldConstraints::ConstraintOriginLayer;
|
||||
|
@ -364,6 +364,7 @@ class GUI_EXPORT QgsAttributeForm : public QWidget
|
||||
//! constraints management
|
||||
void updateAllConstraints();
|
||||
void updateConstraints( QgsEditorWidgetWrapper *w );
|
||||
void updateContainersVisibility();
|
||||
void updateConstraint( const QgsFeature &ft, QgsEditorWidgetWrapper *eww );
|
||||
bool currentFormFeature( QgsFeature &feature );
|
||||
bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions );
|
||||
|
Loading…
x
Reference in New Issue
Block a user