[Qt-interest] Popup Baloon with trayIcon

Sachin Srivastava sachin.srivastava at enterprisedb.com
Wed Aug 26 12:04:19 CEST 2009


Hi all,

I am using qt 4.5 and Fedora 11.

I wanted to create a trayIcon and a popup-baloon associated with it. Now 
the problem is, the popup-baloon shows up in extreme left corner of the 
system tray and not where the trayIcon is?

snippet of code i am using:

--------------------------------------------
trayIcon->setIcon(icon);
setWindowIcon(icon);

trayIcon->show();

if (trayIcon->isVisible())
         trayIcon->showMessage(tr("SomeTitle!"), tr("Some Message"), 
QSystemTrayIcon::Information, 5000);

--------------------------------------

However, if i add a dummy showMessage for 1 millisecond , the 
popup-baloon comes at the right place.

--------------------------------------------
trayIcon->setIcon(icon);
setWindowIcon(icon);

trayIcon->show();

trayIcon->showMessage(tr("DummyTitle!"), tr("Dummy Message"), 
QSystemTrayIcon::Information, 1);
if (trayIcon->isVisible())
         trayIcon->showMessage(tr("SomeTitle!"), tr("Some Message"), 
QSystemTrayIcon::Information, 5000);

--------------------------------------

As the above solves the problem, but I am sure there is more cleaner 
ways of achieving what i want.

Thanks for your replies.

-- 
Regards,
Sachin Srivastava
www.enterprisedb.com




More information about the Qt-interest-old mailing list