Skip to content
Permalink
Browse files

Merge pull request #38050 from marisn/georeferencer_restore

Do not restore geometry for maximized windows
  • Loading branch information
m-kuhn committed Aug 31, 2020
2 parents f2345c0 + 84cf041 commit afc099f213cd61b0762bc7bce5211549af52dda6
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/gui/qgswidgetstatehelper_p.cpp
@@ -14,6 +14,7 @@
* *
***************************************************************************/
#include "qgswidgetstatehelper_p.h"
#include <QWindow>
#include <QWidget>
#include <QEvent>
#include <QObject>
@@ -46,8 +47,28 @@ bool QgsWidgetStateHelper::eventFilter( QObject *object, QEvent *event )
{
QWidget *widget = qobject_cast<QWidget *>( object );
QString name = widgetSafeName( widget );

#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
// If window is already maximized by Window Manager,
// there is no need to restore its geometry as it might lead to
// an incorrect state of QFlags<Qt::WindowState>(WindowMinimized|WindowMaximized)
// thus minimizing window after it just has been restored by WM.
// Inability to restore minimzed windows has been observed with
// KWin 5.19 and Qt 5.15 running under X11.
QWindow *win = widget->windowHandle();
if ( !win )
return QObject::eventFilter( object, event );

if ( !( win->windowStates() & Qt::WindowMaximized ) )
{
QString key = mKeys[name];
QgsGuiUtils::restoreGeometry( widget, key );
}
#else
QString key = mKeys[name];
QgsGuiUtils::restoreGeometry( widget, key );
#endif

widget->setProperty( "widgetStateHelperWasShown", QVariant( true ) );
}
return QObject::eventFilter( object, event );

0 comments on commit afc099f

Please sign in to comment.
You can’t perform that action at this time.