Skip to content

Commit

Permalink
Revert 5b9be7a
Browse files Browse the repository at this point in the history
Since the attribute table dialog object name is set to match
the layer/featureid combo, this commit was causing the attribute
form dialog to remember its position and size for each
feature/layer combo individually.

That's NOT what we want!

Fixes #18426

(cherry-picked from bf12404)
  • Loading branch information
nyalldawson committed Mar 16, 2018
1 parent aaf7c00 commit 7521a82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/gui/qgsattributedialog.cpp
Expand Up @@ -17,7 +17,6 @@

#include "qgsattributedialog.h"

#include "qgsgui.h"
#include "qgsattributeform.h"
#include "qgshighlight.h"
#include "qgsapplication.h"
Expand All @@ -40,6 +39,22 @@ QgsAttributeDialog::~QgsAttributeDialog()

if ( mOwnedFeature )
delete mOwnedFeature;

saveGeometry();
}

void QgsAttributeDialog::saveGeometry()
{
// WARNING!!!! Don't use QgsGui::enableAutoGeometryRestore for this dialog -- the object name
// is dynamic and is set to match the layer/feature combination.
QgsSettings().setValue( QStringLiteral( "Windows/AttributeDialog/geometry" ), QDialog::saveGeometry() );
}

void QgsAttributeDialog::restoreGeometry()
{
// WARNING!!!! Don't use QgsGui::enableAutoGeometryRestore for this dialog -- the object name
// is dynamic and is set to match the layer/feature combination.
QDialog::restoreGeometry( QgsSettings().value( QStringLiteral( "Windows/AttributeDialog/geometry" ) ).toByteArray() );
}

void QgsAttributeDialog::setHighlight( QgsHighlight *h )
Expand Down Expand Up @@ -73,7 +88,6 @@ void QgsAttributeDialog::reject()

void QgsAttributeDialog::init( QgsVectorLayer *layer, QgsFeature *feature, const QgsAttributeEditorContext &context, bool showDialogButtons )
{
QgsGui::enableAutoGeometryRestore( this );
QgsAttributeEditorContext trackedContext = context;
setWindowTitle( tr( "%1 - Feature Attributes" ).arg( layer->name() ) );
setLayout( new QGridLayout() );
Expand All @@ -99,6 +113,7 @@ void QgsAttributeDialog::init( QgsVectorLayer *layer, QgsFeature *feature, const
layout()->setMenuBar( menuBar );
}

restoreGeometry();
focusNextChild();
}

Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsattributedialog.h
Expand Up @@ -125,6 +125,8 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog
static int sFormCounter;
static QString sSettingsPath;

void saveGeometry();
void restoreGeometry();
};

#endif

0 comments on commit 7521a82

Please sign in to comment.