Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8391355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:14:20+00:00 2026-06-09T19:14:20+00:00

I’d like to write a Qt application which main purpose is to warn the

  • 0

I’d like to write a Qt application which main purpose is to warn the user that there are things to do before he should shut down the computer. I thought this is possible, since a lot of applications ask the user to save before quitting when the computer is about to be shut down. I also want the user to be able to interrupt the shut down process, like those applications allow the user to say “Cancel”.

Is there a way to do this in Qt?

If not, how to do this at least in a gnome session? (Support for more desktop environments would be nice, but currently this application is for me and my friends only, and we all use gnome.)

I read about the signal QCoreApplication::aboutToQuit(), but the documentation says that it doesn’t allow user interaction. My application doesn’t use any widget (maybe only a system tray icon), so the QWidget::closeEvent isn’t of any use either.

Will handling the appropriate posix signal help? But as far as I know, such a signal handler may only contain trivial statements and asking the user whether to really shut down isn’t trivial.

Here are some details if it helps: When the user wants to shut down the computer, my application will check if the repository (he configured to watch) is “clean”, i.e. there is nothing to commit. If there is something to be committed, the application should warn the user and let him choose to ignore the uncommitted files or to abort the shut down process (in order to commit the changes).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:14:21+00:00Added an answer on June 9, 2026 at 7:14 pm

    You should implement session handling. When the operating system shuts down, QApplication::commitData() is called and you can ask the session manager to allow user interaction:

    Within this function, no user interaction is possible, unless you ask the manager for explicit permission.

    There is also an example about exactly your use case here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.