mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Fix minimize to tray feature on Win32
This commit is contained in:
@@ -219,7 +219,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
transferListFilters->getStatusFilters()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
transferListFilters->getStatusFilters()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
if(Preferences::startMinimized()) {
|
if(Preferences::startMinimized()) {
|
||||||
setWindowState(Qt::WindowMinimized);
|
showMinimized();
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("GUI Built");
|
qDebug("GUI Built");
|
||||||
@@ -602,12 +602,16 @@ void GUI::on_actionCreate_torrent_triggered() {
|
|||||||
|
|
||||||
bool GUI::event(QEvent * e) {
|
bool GUI::event(QEvent * e) {
|
||||||
if(e->type() == QEvent::WindowStateChange) {
|
if(e->type() == QEvent::WindowStateChange) {
|
||||||
|
qDebug("Window change event");
|
||||||
//Now check to see if the window is minimised
|
//Now check to see if the window is minimised
|
||||||
if(isMinimized()) {
|
if(isMinimized()) {
|
||||||
qDebug("minimisation");
|
qDebug("minimisation");
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
|
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
|
||||||
hide();
|
qDebug("Minimize to Tray enabled, hiding!");
|
||||||
|
e->accept();
|
||||||
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user