Skip to content
Permalink
Browse files

Merge pull request #6191 from dgoedkoop/attributeformonchanged

[bugfix] Add dirty bit to attribute form
  • Loading branch information
elpaso committed Feb 2, 2018
2 parents 7fb8de9 + 37fa41b commit 4895c2c3f60ad0f7ed7d2aba33c56b3b7a7cb09d
Showing with 10 additions and 1 deletion.
  1. +8 −1 src/gui/qgsattributeform.cpp
  2. +2 −0 src/gui/qgsattributeform.h
@@ -572,7 +572,7 @@ bool QgsAttributeForm::saveMultiEdits()

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

mIsSaving = true;
@@ -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()
@@ -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:
@@ -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
{

0 comments on commit 4895c2c

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