Results 1 to 3 of 3

Thread: QSystemTrayIcon closed " unexpectedly"

  1. #1
    Join Date
    Dec 2006
    Location
    Kędzierzyn-Koźle
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSystemTrayIcon closed " unexpectedly"

    Hello
    I have encounter following issue.
    I have an instance of DaemonTray that is subclass of QSystemTrayIcon
    executing following code close whole program ... (Task bar icon disappears)

    Qt Code:
    1. DaemonTray::config()
    2. {
    3. ConfigDialog dialog;
    4. dialog.exec()
    5. }
    To copy to clipboard, switch view to plain text mode 

    When I close the dialog with close() or reject() or clicking on X button on the dialog .. the whole application is closed.
    I find out that reason is in QApplication::quitOnLastWindowClosed() which is default set to true. But the above behaviour occurs only on windows on linux with the same tools gcc 3.4.5 and Qt 4.2.2 application does not close ... can anybody explain to me what makes that difference ???
    Last edited by wysota; 9th December 2006 at 23:38.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSystemTrayIcon closed " unexpectedly"

    My guess is the nature of the tray icon. On Linux it seems to be a window as well, so as long as it is open, the application won't quit. Simply call setQuitOnLastWindowClosed ( false ) on your QApplication object and you'll have a coherent behaviour.

  3. #3
    Join Date
    Dec 2006
    Location
    Kędzierzyn-Koźle
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSystemTrayIcon closed " unexpectedly"

    This is how I solved this problem, by "I find out that reason is in QApplication::quitOnLastWindowClosed() which is default set to true" I mean it have to be set false
    So it seems it that tray icon is window under linux only, even it does not have widget interface (at least to the programmer). Under windows it is not "counted" as last or any window at all.

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.