PDA

View Full Version : dialog box as a system tray popup



dpn
22nd September 2013, 15:16
Hi All,

How to display my dialog box as a system tray popup. Does qt provides any specific api's to make dialog as a popup of SystemTray?

Thanks.

toufic.dbouk
22nd September 2013, 18:43
Hey there,
im not sure what do you mean by dialog box as a system tray popup, if you want your dialog Ui to appear on a specific event ,
just connect the dialog's open or exec slot (depending on your need ) to whatever signal your waiting for to invoke the dialog, you can set the model to true to prevent interactions with other windows.
if you want to just show a warning or information or anything like a small message , you can use QMessageBox (http://qt-project.org/doc/qt-5.0/qtwidgets/qmessagebox.html) , it has some really nice features.
you can also look at this link , it might be helpful http://qt-project.org/forums/viewthread/6785
Hope this helps.

dpn
22nd September 2013, 20:06
For instance, there is an app called "abc". It has system tray icon. "abc" application has to show notifications in some scenarios. There notifications are like tooltip windows on windows. But, for "abc" application, it has to show rich gui window as a system tray notification. I cannot use QMessageBox for this purpose. This rich gui window should be prompted at notification position.

If I run through my application, the position is always center of desktop. The position should change to default system notification position.

This is what I am looking for. Thanks toufic.

toufic.dbouk
22nd September 2013, 23:22
I am not sure that i know what your exactly talking about.
But if you mean that you want your application to show a notification at the system tray and then by pressing the information message or box it will open the your rich GUI window take a look at this : System Tray Icon Example (http://qt-project.org/doc/qt-4.8/desktop-systray.html).
implement your rich GUI window and a dialog add all your GUI interfaces and accessibility and then connect it with the system tray information message.( maybe on click message show your window ).
some pics would explain it more if you still want to clarify your idea.


This rich gui window should be prompted at notification position.
cant you just create and show the dialog when the notification is needed ? and try to change the position as needed, then when your function is done clean it up
example :

connect(this,SIGNAL(emitNotification(/*implement it*/)),mDialog,SLOT(showDialog(/*implement it*/)));
Good Luck.

dpn
23rd September 2013, 07:03
Yes. QSystemTrayIcon::showMessage(). I want to replace this default notification with my own dialog. I need showMessage() geometry in overridden function.

toufic.dbouk
23rd September 2013, 11:56
Yes. QSystemTrayIcon::showMessage(). I want to replace this default notification with my own dialog. I need showMessage() geometry in overridden function.
i guess you answered your self here.
you have to create your own pop up widget and center it as you want.
Also try to catch the event that is causing the balloon information message to show , and instead of showing the balloon , directly show your GUI Window.

i am not sure of the logic behind what you want , i wouldn't say it is flexible and at ease to pop out a whole rich GUI window out of a sudden for the user.
i would have showed the balloon message and then upon clicking it, show the window you want.

i hope this helps , you can always wait for responses from more experienced developers. we both can learn something new every minute.