Mercurial > hg > bitcoin
changeset 2831:48e56681917e draft
Yet another attempt at implementing "minimize to tray" that works on all OSes
author | Wladimir J. van der Laan <laanwj@gmail.com> |
---|---|
date | Thu, 15 Mar 2012 22:30:08 +0100 |
parents | 28b6355a3dfa |
children | dcd71ce7f024 |
files | src/qt/bitcoingui.cpp |
diffstat | 1 files changed, 5 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -45,6 +45,7 @@ #include <QStackedWidget> #include <QDateTime> #include <QMovie> +#include <QTimer> #include <QDragEnterEvent> #include <QUrl> @@ -523,29 +524,21 @@ 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) + if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) { - // Minimized, hide the window from taskbar - setWindowFlags(windowFlags() | Qt::Tool); - return; - } - else if(wasMinimized && !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)