fix:Win+Up Win+Down to restore and save geometry

the above shortkey can not restore geometry after resize the window
This commit is contained in:
xiaoyifang 2022-02-25 22:51:39 +08:00
parent 70e7a49db8
commit aeee511859

View file

@ -2474,23 +2474,23 @@ bool MainWindow::handleBackForwardMouseButtons ( QMouseEvent * event) {
bool MainWindow::eventFilter( QObject * obj, QEvent * ev ) bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if( obj == this && ev->type() == gdStoreNormalGeometryEvent ) // if( obj == this && ev->type() == gdStoreNormalGeometryEvent )
{ // {
if( !isMaximized() && !isMinimized() && !isFullScreen() ) // if( !isMaximized() && !isMinimized() && !isFullScreen() )
cfg.normalMainWindowGeometry = normalGeometry(); // cfg.normalMainWindowGeometry = normalGeometry();
ev->accept(); // ev->accept();
return true; // return true;
} // }
if( obj == this && ev->type() == gdApplyNormalGeometryEvent ) // if( obj == this && ev->type() == gdApplyNormalGeometryEvent )
{ // {
if( !isMaximized() && !isMinimized() && !isFullScreen() ) // if( !isMaximized() && !isMinimized() && !isFullScreen() )
{ // {
setGeometry( cfg.normalMainWindowGeometry ); // setGeometry( cfg.normalMainWindowGeometry );
} // }
ev->accept(); // ev->accept();
return true; // return true;
} // }
#endif #endif
if ( ev->type() == QEvent::ShortcutOverride if ( ev->type() == QEvent::ShortcutOverride
|| ev->type() == QEvent::KeyPress ) || ev->type() == QEvent::KeyPress )
@ -2527,11 +2527,11 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
if ( obj == this && ( ev->type() == QEvent::Move || ev->type() == QEvent::Resize ) ) if ( obj == this && ( ev->type() == QEvent::Move || ev->type() == QEvent::Resize ) )
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if( !isMaximized() && !isMinimized() && !isFullScreen() && gdAskMessage != 0xFFFFFFFF ) // if( !isMaximized() && !isMinimized() && !isFullScreen() && gdAskMessage != 0xFFFFFFFF )
{ // {
QEvent *ev = new QEvent( gdStoreNormalGeometryEvent ); // QEvent *ev = new QEvent( gdStoreNormalGeometryEvent );
qApp->postEvent( this, ev ); // qApp->postEvent( this, ev );
} // }
#endif #endif
if ( !cfg.preferences.searchInDock ) if ( !cfg.preferences.searchInDock )
{ {