feat(macOS): click dock icon to show window when it's hidden

This commit is contained in:
2025-07-22 00:08:06 +08:00
parent 505ab9e2a6
commit 347681e604
2 changed files with 14 additions and 1 deletions

View File

@ -76,6 +76,18 @@ int main(int argc, char *argv[])
w.showUrls({url});
w.initWindowSize();
});
// Handle dock icon clicks to show hidden window
a.connect(&a, &QApplication::applicationStateChanged, [&w](Qt::ApplicationState state) {
if (state == Qt::ApplicationActive && w.isHidden()) {
w.showUrls({});
w.galleryCurrent(true, true);
w.setWindowOpacity(1);
w.showNormal();
w.raise();
w.activateWindow();
}
});
#endif // Q_OS_MACOS
QStringList urlStrList = parser.positionalArguments();

View File

@ -188,6 +188,7 @@ void MainWindow::showUrls(const QList<QUrl> &urls)
m_pm->loadPlaylist(urls);
} else {
m_graphicsView->showText(tr("File url list is empty"));
m_pm->setPlaylist(urls);
return;
}
@ -312,7 +313,7 @@ QStringList MainWindow::supportedImageFormats()
void MainWindow::showEvent(QShowEvent *event)
{
updateWidgetsPosition();
return FramelessWindow::showEvent(event);
}