Results 1 to 2 of 2

Thread: Break system shutdown when in my program I want minimize instead close.

  1. #1
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Break system shutdown when in my program I want minimize instead close.

    I don't know how properly write program which will minimize instead close, and which do not prevent system from close (when I want restart system or shutdown). For now when my program is showed (window is visible for user) and I click close system, then closing system is break by my program and my program is minimized. I cant find out how to handle this special case when program should close instead minimize.... Please help me.

  2. #2
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Break system shutdown when in my program I want minimize instead close.

    Check out QApplication::commitDataRequest() signal. By default when the system is going to shutdown will emit this signal and if you don't get it QApplication will send closeEvent to all the opened windows, if any window ignore the close event(like you are doing when minimizing) the shutdown will be canceled. To avoid such a case just connect to that signal(note you should explicitly use Qt:irectConnection for this signal as the documentation says) and rise some flag or send some custom event to your windows in order to let them know that when they receive closeEvent they must accept it.

  3. The following user says thank you to The Storm for this useful post:

    jmj (15th August 2010)

Similar Threads

  1. Minimize to system tray
    By aLiNuSh in forum Newbie
    Replies: 17
    Last Post: 4th March 2010, 12:51
  2. Disable the minimize, maximize,close buttons
    By qtlinuxnewbie in forum Newbie
    Replies: 10
    Last Post: 25th February 2010, 10:18
  3. Finalization on system shutdown
    By nomadoro in forum Qt Programming
    Replies: 4
    Last Post: 30th October 2009, 19:30
  4. how to remove maximize minimize close
    By tsuibin in forum Qt Programming
    Replies: 8
    Last Post: 2nd April 2009, 18:28
  5. Minimize to system tray
    By krivenok in forum Qt Programming
    Replies: 5
    Last Post: 13th January 2009, 04:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.