开发者

How to catch the QSystemTrayIcon quit event?

I ha开发者_JS百科ve a QSystemTrayIcon subclass. Inside it, I have:

quitAction = new QAction(tr("&Quit"), m_parent);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); 

CloseEvent doesn't work here. How can I catch this quit event? I want to save data before closing.


You should connect your cleanup/save code to the QCoreApplication::aboutToQuit() signal.

This signal is emitted when the application is about to quit the main event loop, e.g. when the event loop level drops to zero. This may happen either after a call to quit() from inside the application or when the users shuts down the entire desktop session.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜