chore(macOS): change close-window behavior
On macOS, now closing the window will actually hide the window instead of quit the application, thus it will match to some other macOS application's behavior. Additionally, since our binary is not signed, this could avoid seeing the request permission dialogs everytime user attempts to open an image file inside a private place (e.g. places like the "Downloads" folder and "access data from other apps").
This commit is contained in:
parent
ff4f71c1e6
commit
6d7d0e4e1d
@ -63,7 +63,12 @@ int main(int argc, char *argv[])
|
||||
FileOpenEventHandler * fileOpenEventHandler = new FileOpenEventHandler(&a);
|
||||
a.installEventFilter(fileOpenEventHandler);
|
||||
a.connect(fileOpenEventHandler, &FileOpenEventHandler::fileOpen, [&w](const QUrl & url){
|
||||
if (w.isHidden()) w.showNormal();
|
||||
if (w.isHidden()) {
|
||||
w.setWindowOpacity(1);
|
||||
w.showNormal();
|
||||
} else {
|
||||
w.activateWindow();
|
||||
}
|
||||
w.showUrls({url});
|
||||
w.initWindowSize();
|
||||
});
|
||||
|
@ -71,7 +71,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
m_exitAnimationGroup->addAnimation(m_fadeOutAnimation);
|
||||
m_exitAnimationGroup->addAnimation(m_floatUpAnimation);
|
||||
connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished,
|
||||
#ifdef Q_OS_MAC
|
||||
this, &QWidget::hide);
|
||||
#else
|
||||
this, &QWidget::close);
|
||||
#endif
|
||||
|
||||
GraphicsScene * scene = new GraphicsScene(this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user