Skip to content

Commit

Permalink
feat: show mainwindow on click system tray
Browse files Browse the repository at this point in the history
  • Loading branch information
lanthora committed Jul 11, 2024
1 parent b11ac90 commit e46141a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ void MainWindow::onSystemTrayActivated(QSystemTrayIcon::ActivationReason reason)
{
// 左键点击托盘图标隐藏或恢复主窗口
if (reason == QSystemTrayIcon::Trigger) {
if (isVisible() && !isMinimized()) {
if (isVisible() && isActiveWindow()) {
hide();
} else {
showNormal();
show();
activateWindow();
}
}
}
Expand Down

0 comments on commit e46141a

Please sign in to comment.