Skip to content

Commit 7521a82

Browse files
committed
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)
1 parent aaf7c00 commit 7521a82

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/gui/qgsattributedialog.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include "qgsattributedialog.h"
1919

20-
#include "qgsgui.h"
2120
#include "qgsattributeform.h"
2221
#include "qgshighlight.h"
2322
#include "qgsapplication.h"
@@ -40,6 +39,22 @@ QgsAttributeDialog::~QgsAttributeDialog()
4039

4140
if ( mOwnedFeature )
4241
delete mOwnedFeature;
42+
43+
saveGeometry();
44+
}
45+
46+
void QgsAttributeDialog::saveGeometry()
47+
{
48+
// WARNING!!!! Don't use QgsGui::enableAutoGeometryRestore for this dialog -- the object name
49+
// is dynamic and is set to match the layer/feature combination.
50+
QgsSettings().setValue( QStringLiteral( "Windows/AttributeDialog/geometry" ), QDialog::saveGeometry() );
51+
}
52+
53+
void QgsAttributeDialog::restoreGeometry()
54+
{
55+
// WARNING!!!! Don't use QgsGui::enableAutoGeometryRestore for this dialog -- the object name
56+
// is dynamic and is set to match the layer/feature combination.
57+
QDialog::restoreGeometry( QgsSettings().value( QStringLiteral( "Windows/AttributeDialog/geometry" ) ).toByteArray() );
4358
}
4459

4560
void QgsAttributeDialog::setHighlight( QgsHighlight *h )
@@ -73,7 +88,6 @@ void QgsAttributeDialog::reject()
7388

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

116+
restoreGeometry();
102117
focusNextChild();
103118
}
104119

src/gui/qgsattributedialog.h

+2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog
125125
static int sFormCounter;
126126
static QString sSettingsPath;
127127

128+
void saveGeometry();
129+
void restoreGeometry();
128130
};
129131

130132
#endif

0 commit comments

Comments
 (0)