diff --git a/mainwindow.cc b/mainwindow.cc index faf5c050..00fce360 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -74,6 +74,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): wordFinder( this ), newReleaseCheckTimer( this ), wordListSelChanged( false ) +, wasMaximized( false ) #ifdef Q_OS_WIN32 , gdAskMessage( 0xFFFFFFFF ) #endif @@ -682,6 +683,8 @@ MainWindow::MainWindow( Config::Class & cfg_ ): updateStatusLine(); + wasMaximized = isMaximized(); + #ifdef Q_OS_MAC LionSupport::addFullscreen(this); #endif @@ -2000,6 +2003,12 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev ) } } + if ( obj == this && ev->type() == QEvent::WindowStateChange ) + { + QWindowStateChangeEvent *stev = static_cast< QWindowStateChangeEvent *>( ev ); + wasMaximized = ( stev->oldState() == Qt::WindowMaximized && isMinimized() ); + } + if ( ev->type() == QEvent::MouseButtonPress ) { QMouseEvent * event = static_cast< QMouseEvent * >( ev ); @@ -2389,7 +2398,10 @@ void MainWindow::toggleMainWindow( bool onlyShow ) else if ( isMinimized() ) { - showNormal(); + if( wasMaximized ) + showMaximized(); + else + showNormal(); activateWindow(); raise(); shown = true; diff --git a/mainwindow.hh b/mainwindow.hh index 8abf62a7..a77e1c55 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -149,6 +149,8 @@ private: bool wordListSelChanged; + bool wasMaximized; // Window state before minimization + QPrinter & getPrinter(); // Creates a printer if it's not there and returns it /// Applies the qt's stylesheet, given the style's name.