diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-03-15 22:30:08 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-03-16 08:17:11 +0100 |
commit | 08ed96d8564be72b301f500b491633d4185d96f7 (patch) | |
tree | c804b0983d6c5bc086bae3baf6cf6a8437eacd9e /src/qt | |
parent | f94177367a5765f89be526837330459cf840747b (diff) | |
download | bitcoin-08ed96d8564be72b301f500b491633d4185d96f7.tar.xz |
Yet another attempt at implementing "minimize to tray" that works on all OSes
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoingui.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index abf2c381a5..31f220b8a9 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -48,6 +48,7 @@ #include <QMovie> #include <QFileDialog> #include <QDesktopServices> +#include <QTimer> #include <QDragEnterEvent> #include <QUrl> @@ -558,29 +559,21 @@ void BitcoinGUI::error(const QString &title, const QString &message) void BitcoinGUI::changeEvent(QEvent *e) { + QMainWindow::changeEvent(e); #ifndef Q_WS_MAC // Ignored on Mac if(e->type() == QEvent::WindowStateChange) { if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray()) { QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e); - bool wasMinimized = wsevt->oldState() & Qt::WindowMinimized; - bool isMinimized = windowState() & Qt::WindowMinimized; - if(!wasMinimized && isMinimized) - { - // Minimized, hide the window from taskbar - setWindowFlags(windowFlags() | Qt::Tool); - return; - } - else if(wasMinimized && !isMinimized) + if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) { - // Unminimized, show the window in taskbar - setWindowFlags(windowFlags() &~ Qt::Tool); + QTimer::singleShot(0, this, SLOT(hide())); + e->ignore(); } } } #endif - QMainWindow::changeEvent(e); } void BitcoinGUI::closeEvent(QCloseEvent *event) |