feat(macOS): click dock icon to show window when it's hidden
This commit is contained in:
12
app/main.cpp
12
app/main.cpp
@ -76,6 +76,18 @@ int main(int argc, char *argv[])
|
|||||||
w.showUrls({url});
|
w.showUrls({url});
|
||||||
w.initWindowSize();
|
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
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
QStringList urlStrList = parser.positionalArguments();
|
QStringList urlStrList = parser.positionalArguments();
|
||||||
|
@ -188,6 +188,7 @@ void MainWindow::showUrls(const QList<QUrl> &urls)
|
|||||||
m_pm->loadPlaylist(urls);
|
m_pm->loadPlaylist(urls);
|
||||||
} else {
|
} else {
|
||||||
m_graphicsView->showText(tr("File url list is empty"));
|
m_graphicsView->showText(tr("File url list is empty"));
|
||||||
|
m_pm->setPlaylist(urls);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +313,7 @@ QStringList MainWindow::supportedImageFormats()
|
|||||||
void MainWindow::showEvent(QShowEvent *event)
|
void MainWindow::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
updateWidgetsPosition();
|
updateWidgetsPosition();
|
||||||
|
|
||||||
return FramelessWindow::showEvent(event);
|
return FramelessWindow::showEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user