diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2791e7d3d..e6b2f1858 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -101,7 +101,8 @@ MainWindow::MainWindow(QNetworkAccessManager* network, Engine::Type engine, QWid equalizer_(new Equalizer), playlist_menu_(new QMenu(this)), library_sort_model_(new QSortFilterProxyModel(this)), - track_position_timer_(new QTimer(this)) + track_position_timer_(new QTimer(this)), + was_maximized_(false) { ui_.setupUi(this); #ifndef Q_OS_DARWIN @@ -625,7 +626,16 @@ void MainWindow::closeEvent(QCloseEvent* event) { void MainWindow::SetHiddenInTray(bool hidden) { settings_.setValue("hidden", hidden); - setVisible(!hidden); + + if (hidden) { + was_maximized_ = isMaximized(); + hide(); + } else { + if (was_maximized_) + showMaximized(); + else + show(); + } } void MainWindow::ClearLibraryFilter() { diff --git a/src/mainwindow.h b/src/mainwindow.h index 9911304e4..9c4c5bd58 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -168,6 +168,8 @@ class MainWindow : public QMainWindow { QTimer* track_position_timer_; QSettings settings_; + + bool was_maximized_; }; #endif // MAINWINDOW_H