mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -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);
|
||||
|
||||
if(Preferences::startMinimized()) {
|
||||
setWindowState(Qt::WindowMinimized);
|
||||
showMinimized();
|
||||
}
|
||||
|
||||
qDebug("GUI Built");
|
||||
@@ -602,12 +602,16 @@ void GUI::on_actionCreate_torrent_triggered() {
|
||||
|
||||
bool GUI::event(QEvent * e) {
|
||||
if(e->type() == QEvent::WindowStateChange) {
|
||||
qDebug("Window change event");
|
||||
//Now check to see if the window is minimised
|
||||
if(isMinimized()) {
|
||||
qDebug("minimisation");
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
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