8

I've a little problem with tray icon under windows. After my Qt application stopps (normal exit) the icon still remains in system bar. It disapears only when I move mouse cursor over it. I tried to hide it in the destructor of my window but it fails: I tried .setVisible(false).

Any ideas? Thanks.

P.S. I remember I had the same problem with SWT/Java.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Sebastian Dusza
  • 2,470
  • 2
  • 30
  • 54

2 Answers2

6

I wouldn't hide it in the destructor. It will likely be an invalid reference at that point. I would put it in where your event for "Exit" happens.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
3

If you're not able to call it from a destructor, you could connect the QCoreApplication::aboutToQuit() signal to the QSystemTrayIcon::hide() slot.

Anigif
  • 872
  • 8
  • 17