PDA

View Full Version : QSystemTray stays longer than it should !



probine
21st December 2006, 10:53
I just created a QSystemTray.



trayIcon->showMessage("Beta 0.9", "You are logged in", trayIcon->Information, 1);

The idea is that the message displayed in the tray should stay for a very short period of time, but it stays there for about 10 seconds.

1. How can I make sure that the message disappears after 2 seconds ?

2. The system tray icon is a child of my QMainWindow, but when I close the window, the icon stays in the system tray. Why ? How can I destroy it together with the window ?

jpn
21st December 2006, 11:20
1. How can I make sure that the message disappears after 2 seconds ?
Notice that QSystemTrayIcon::showMessage() takes the time parameter as milliseconds so you should try passing 2000.



2. The system tray icon is a child of my QMainWindow, but when I close the window, the icon stays in the system tray. Why ? How can I destroy it together with the window ?
Closing a window does not delete it unless you set the Qt::WA_DeleteOnClose attribute:


setAttribute(Qt::WA_DeleteOnClose, true);

probine
21st December 2006, 11:37
I have set the time to 2000, but it is still the same... no matter what it is the same

I am showing this bubble after I call show(); in the tray icon !!!

What is wrong ?