Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #941 from laanwj/2012_03_newminimizetray

Yet another attempt of a "minimize to tray" that works on all OSes
  • Loading branch information...
commit 8e910c89b8fe4a547d50c8d65606c78d9e27ca30 2 parents f941773 + 08ed96d
@laanwj laanwj authored
Showing with 5 additions and 12 deletions.
  1. +5 −12 src/qt/bitcoingui.cpp
View
17 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)
Please sign in to comment.
Something went wrong with that request. Please try again.