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
  • Loading branch information
nyalldawson committed Mar 16, 2018
1 parent 8658da3 commit bf12404
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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


#include "qgsattributedialog.h" #include "qgsattributedialog.h"


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


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


restoreGeometry();
focusNextChild(); focusNextChild();
} }


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


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


#endif #endif

0 comments on commit bf12404

Please sign in to comment.