If you're talking about UNIX "kill" command, it send a SIGNAL to the application.
Some signals can be handled bou others cannot. Read here and here for more details.
If you handle a signal, you can send a quit event to QApplication
If you're talking about UNIX "kill" command, it send a SIGNAL to the application.
Some signals can be handled bou others cannot. Read here and here for more details.
If you handle a signal, you can send a quit event to QApplication
A camel can go 14 days without drink,
I can't!!!
Thanks,
I finally make it work by this code:
void signalhandler(int sig)
{
if (sig == SIGINT)
{
printf("will quit by SIGINT\n");
qApp->quit();
}
else if (sig == SIGTERM)
{
printf("will quit by SIGTERM\n");
qApp->quit();
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
autoprint w;
signal(SIGINT,signalhandler);
signal(SIGTERM,signalhandler);
QObject::connect(&a, SIGNAL(aboutToQuit()),&w,SLOT(cleanup()));
w.show();
return a.exec();
}
Bookmarks