Skip to content

Commit

Permalink
Merge pull request #57700 from qgis/backport-57686-to-queued_ltr_back…
Browse files Browse the repository at this point in the history
…ports

[Backport queued_ltr_backports] Fix add feature dialog does not restore position when shown modally
  • Loading branch information
alexbruy authored Jun 7, 2024
2 parents d5542e1 + 7d307f7 commit dd86858
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions python/PyQt6/gui/auto_generated/qgsattributedialog.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ Intercept window activate/deactivate events to show/hide the highlighted feature
:return: The same as the parent QDialog
%End

virtual void showEvent( QShowEvent *event );


void setExtraContextScope( QgsExpressionContextScope *extraScope /Transfer/ );
%Docstring
Sets ``extraScope`` as an additional expression context scope to be used
Expand Down
3 changes: 3 additions & 0 deletions python/gui/auto_generated/qgsattributedialog.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ Intercept window activate/deactivate events to show/hide the highlighted feature
:return: The same as the parent QDialog
%End

virtual void showEvent( QShowEvent *event );


void setExtraContextScope( QgsExpressionContextScope *extraScope /Transfer/ );
%Docstring
Sets ``extraScope`` as an additional expression context scope to be used
Expand Down
9 changes: 7 additions & 2 deletions src/gui/qgsattributedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,20 @@ void QgsAttributeDialog::show()
{
QDialog::show();

raise();
activateWindow();
}

void QgsAttributeDialog::showEvent( QShowEvent *event )
{
QDialog::showEvent( event );
// We cannot call restoreGeometry() in the constructor or init because the dialog is not yet visible
// and the geometry restoration will not take the window decorations (frame) into account.
if ( mFirstShow )
{
mFirstShow = false;
restoreGeometry();
}
raise();
activateWindow();
}

void QgsAttributeDialog::reject()
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsattributedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog, public QgsMapLayerActionCo
*/
bool event( QEvent *e ) override;

void showEvent( QShowEvent *event ) override;

/**
* Sets \a extraScope as an additional expression context scope to be used
* for calculations in this form.
Expand Down

0 comments on commit dd86858

Please sign in to comment.