Skip to content

Commit

Permalink
Merge pull request #6191 from dgoedkoop/attributeformonchanged
Browse files Browse the repository at this point in the history
[bugfix] Add dirty bit to attribute form
  • Loading branch information
elpaso committed Feb 2, 2018
2 parents 7fb8de9 + 37fa41b commit 4895c2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/gui/qgsattributeform.cpp
Expand Up @@ -572,7 +572,7 @@ bool QgsAttributeForm::saveMultiEdits()

bool QgsAttributeForm::save()
{
if ( mIsSaving )
if ( mIsSaving || !mDirty )
return true;

mIsSaving = true;
Expand Down Expand Up @@ -601,16 +601,20 @@ bool QgsAttributeForm::save()

mIsSaving = false;
mUnsavedMultiEditChanges = false;
mDirty = false;

return success;
}

void QgsAttributeForm::resetValues()
{
mValuesInitialized = false;
Q_FOREACH ( QgsWidgetWrapper *ww, mWidgets )
{
ww->setFeature( mFeature );
}
mValuesInitialized = true;
mDirty = false;
}

void QgsAttributeForm::resetSearch()
Expand Down Expand Up @@ -665,6 +669,9 @@ void QgsAttributeForm::onAttributeChanged( const QVariant &value )
if ( oldValue == value && oldValue.isNull() == value.isNull() )
return;

if ( mValuesInitialized )
mDirty = true;

switch ( mMode )
{
case SingleEditMode:
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsattributeform.h
Expand Up @@ -364,6 +364,8 @@ class GUI_EXPORT QgsAttributeForm : public QWidget
QList< QgsAttributeFormWidget *> mFormWidgets;
QgsExpressionContext mExpressionContext;
QMap<const QgsVectorLayerJoinInfo *, QgsFeature> mJoinedFeatures;
bool mValuesInitialized = false;
bool mDirty = false;

struct ContainerInformation
{
Expand Down

0 comments on commit 4895c2c

Please sign in to comment.