Results 1 to 2 of 2

Thread: Minimize to tray - crash

  1. #1
    Join Date
    Sep 2009
    Location
    Warsaw/Poland
    Posts
    56
    Thanks
    8
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Minimize to tray - crash

    Hi,

    I need help, I want to minimize program to tray, and everything is ok but when program is minimized and messagebox (or any dialog/popup) shows program is quiting with Exited normally (?!) Tested on qt 4.7 and 4.8.
    So how and what I need to change in this code ? Or maybe there is better solution for minimizing program ? (I need example of course)

    Qt Code:
    1. void MainWindow::changeEvent(QEvent *event)
    2. {
    3. QMainWindow::changeEvent(event);
    4.  
    5. if (event->type() == QEvent::WindowStateChange)
    6. {
    7.  
    8. if ((e->oldState() != Qt::WindowMinimized) && isMinimized())
    9. {
    10. if (Core::instance()->settings["minimize_to_tray"] == "on")
    11. {
    12. QTimer::singleShot(0, this, SLOT(hide()));
    13. event->ignore();
    14. }
    15. }
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by mero; 7th February 2012 at 08:39.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Minimize to tray - crash

    Does the app crash before the message appears or after you close it?
    If app crashes after closing the dialog my guess is that you have Qt::WA_QuitOnClose set to true.

    If not, use debugger to see where and why it crashes and post relevant code or compilable example of the issue.

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

    mero (22nd July 2012)

Similar Threads

  1. Minimize to Tray
    By QT8seven in forum Qt Programming
    Replies: 3
    Last Post: 5th December 2011, 11:12
  2. Minimize to system tray
    By aLiNuSh in forum Newbie
    Replies: 17
    Last Post: 4th March 2010, 12:51
  3. Minimize to system tray
    By krivenok in forum Qt Programming
    Replies: 5
    Last Post: 13th January 2009, 04:34
  4. Tray Icon
    By vishesh in forum Qt Programming
    Replies: 1
    Last Post: 12th July 2007, 19:10
  5. Tray Ballon
    By eu.x in forum Newbie
    Replies: 5
    Last Post: 28th February 2007, 12:00

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.