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 4895c2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
@@ -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.