mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge pull request #941 from laanwj/2012_03_newminimizetray
Yet another attempt of a "minimize to tray" that works on all OSes
This commit is contained in:
commit
8e910c89b8
@ -48,6 +48,7 @@
|
|||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@ -558,29 +559,21 @@ void BitcoinGUI::error(const QString &title, const QString &message)
|
|||||||
|
|
||||||
void BitcoinGUI::changeEvent(QEvent *e)
|
void BitcoinGUI::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
|
QMainWindow::changeEvent(e);
|
||||||
#ifndef Q_WS_MAC // Ignored on Mac
|
#ifndef Q_WS_MAC // Ignored on Mac
|
||||||
if(e->type() == QEvent::WindowStateChange)
|
if(e->type() == QEvent::WindowStateChange)
|
||||||
{
|
{
|
||||||
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
|
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
|
||||||
{
|
{
|
||||||
QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e);
|
QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e);
|
||||||
bool wasMinimized = wsevt->oldState() & Qt::WindowMinimized;
|
if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized())
|
||||||
bool isMinimized = windowState() & Qt::WindowMinimized;
|
|
||||||
if(!wasMinimized && isMinimized)
|
|
||||||
{
|
{
|
||||||
// Minimized, hide the window from taskbar
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
setWindowFlags(windowFlags() | Qt::Tool);
|
e->ignore();
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(wasMinimized && !isMinimized)
|
|
||||||
{
|
|
||||||
// Unminimized, show the window in taskbar
|
|
||||||
setWindowFlags(windowFlags() &~ Qt::Tool);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
QMainWindow::changeEvent(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::closeEvent(QCloseEvent *event)
|
void BitcoinGUI::closeEvent(QCloseEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user