Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am writing a Qt application and have run into the following problem: when the user logs out or attempts to shut down the machine, the application is instantly terminated without providing it any chance to save any data. I assume the app needs to listen for some event. I tried listening for the SIGTERM signal, but my application was still terminated before it had a chance to respond to the signal.

What options do I have?

share|improve this question
add comment

1 Answer

I'm starting to use Qt for application development and I have found a "Session Management" chapter in Qt Reference Documentation. I think you can find some interesting.

A session is a group of running applications, each of which has a particular state. The session is controlled by a service called the session manager. The applications participating in the session are called session clients. [...] Start by reimplementing QApplication::commitData() to enable your application to take part in the graceful logout process. [...]

You can find it here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.