Skip to content
Permalink
Browse files

Revert 5b9be7a

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 15, 2018
1 parent aaf7c00 commit 7521a82ae331d8f25a6279b32f4a6511cd287d74
Showing with 19 additions and 2 deletions.
  1. +17 −2 src/gui/qgsattributedialog.cpp
  2. +2 −0 src/gui/qgsattributedialog.h
@@ -17,7 +17,6 @@

#include "qgsattributedialog.h"

#include "qgsgui.h"
#include "qgsattributeform.h"
#include "qgshighlight.h"
#include "qgsapplication.h"
@@ -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 )
@@ -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() );
@@ -99,6 +113,7 @@ void QgsAttributeDialog::init( QgsVectorLayer *layer, QgsFeature *feature, const
layout()->setMenuBar( menuBar );
}

restoreGeometry();
focusNextChild();
}

@@ -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.
You can’t perform that action at this time.