From 2e9715386d7cb43f0834f6c08f0de639f75f2b2e Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Thu, 8 Sep 2016 11:56:30 +0200 Subject: [PATCH] Small code beautification --- src/gui/qgsattributeform.cpp | 13 +++++++------ src/gui/qgsattributeform.h | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gui/qgsattributeform.cpp b/src/gui/qgsattributeform.cpp index ed28e2d488c..df0c9720b0b 100644 --- a/src/gui/qgsattributeform.cpp +++ b/src/gui/qgsattributeform.cpp @@ -81,7 +81,7 @@ QgsAttributeForm::QgsAttributeForm( QgsVectorLayer* vl, const QgsFeature &featur connect( vl, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) ); // constraints management - updateAllConstaints(); + updateAllConstraints(); } QgsAttributeForm::~QgsAttributeForm() @@ -720,7 +720,7 @@ void QgsAttributeForm::onAttributeChanged( const QVariant& value ) emit attributeChanged( eww->field().name(), value ); } -void QgsAttributeForm::updateAllConstaints() +void QgsAttributeForm::updateAllConstraints() { Q_FOREACH ( QgsWidgetWrapper* ww, mWidgets ) { @@ -740,8 +740,7 @@ void QgsAttributeForm::updateConstraints( QgsEditorWidgetWrapper *eww ) eww->updateConstraint( ft ); // update eww dependencies constraint - QList deps; - constraintDependencies( eww, deps ); + QList deps = constraintDependencies( eww ); Q_FOREACH ( QgsEditorWidgetWrapper* depsEww, deps ) depsEww->updateConstraint( ft ); @@ -925,9 +924,9 @@ void QgsAttributeForm::onConstraintStatusChanged( const QString& constraint, } } -void QgsAttributeForm::constraintDependencies( QgsEditorWidgetWrapper* w, - QList& wDeps ) +QList QgsAttributeForm::constraintDependencies( QgsEditorWidgetWrapper* w ) { + QList wDeps; QString name = w->field().name(); // for each widget in the current form @@ -955,6 +954,8 @@ void QgsAttributeForm::constraintDependencies( QgsEditorWidgetWrapper* w, } } } + + return wDeps; } void QgsAttributeForm::preventFeatureRefresh() diff --git a/src/gui/qgsattributeform.h b/src/gui/qgsattributeform.h index 6537e035bd5..623b8695cda 100644 --- a/src/gui/qgsattributeform.h +++ b/src/gui/qgsattributeform.h @@ -321,11 +321,11 @@ class GUI_EXPORT QgsAttributeForm : public QWidget QString createFilterExpression() const; //! constraints management - void updateAllConstaints(); + void updateAllConstraints(); void updateConstraints( QgsEditorWidgetWrapper* w ); bool currentFormFeature( QgsFeature& feature ); bool currentFormValidConstraints( QStringList& invalidFields, QStringList& descriptions ); - void constraintDependencies( QgsEditorWidgetWrapper* w, QList& wDeps ); + QList constraintDependencies( QgsEditorWidgetWrapper* w ); void clearInvalidConstraintsMessage(); void displayInvalidConstraintMessage( const QStringList& invalidFields, const QStringList& description );