PDA

View Full Version : how to make decorated rich popup window instead the default QSystemTrayIcon popup win



umen
27th April 2011, 14:42
I have simple like notification application that sits in the tray every time massage comes
I need it to popup windows , but I need it to be rich so I could color it and add pictures
but all I have is the defulte popup massage box , how can I create new richer one ? that will allways popups above the tray icon?

high_flyer
28th April 2011, 12:01
Well, you need to create the widget it self, and then overload QSystemTrayIcon::showMessage() to show your custom widget instead of the default one.

umen
28th April 2011, 12:42
where can i see example for this ? this is not so simple ...

high_flyer
28th April 2011, 13:02
Example for what?
For creating a custom widget?
For overloading QSystemTrayIcon::showMessage()?

umen
28th April 2011, 13:29
For overloading QSystemTrayIcon::showMessage()

high_flyer
28th April 2011, 13:37
You just subclass QSystemTrayIcon, and re implement showMessage().
If you don't know how to do that, you should probably turn to basic C++ tutorial sites first, until you are comfortable with C++ sub classing, as this is off topic for this forum.
But you can feel free to ask any Qt related questions any time.

umen
28th April 2011, 14:17
I know i know
the main thing is with this popup window , is the calculation of the window to popup in the right place depend on the screen size / title bar place and such ...
do i get it automatically when i subclass it ?

high_flyer
28th April 2011, 14:24
I don't think so, but I don't know, I haven't subclasses QSystemTrayIcon.
However, the original implementation must do the position calculation, so you can "steal" that part from the original implementation.
Actually you can use all the original code, just replace the default widget with your custom one.
So it will probably be just copy&paste, and a rather small change to replace the default info balloon with your custom widget.

Xagen
1st May 2011, 00:18
In russian with screenshots - osd class from Clementine http://slow-tone.blogspot.com/2011/04/qt-pretty-osd.html

umen
1st May 2011, 05:40
i tried to compile the example in visual studio 2008 but it gives me linking problems
1>Linking...
1>qtmaind.lib(qtmain_win.obj) : error LNK2019: unresolved external symbol _main referenced in function _WinMain@16
1>debug\prettyosd.exe : fatal error LNK1120: 1 unresolved externals

Xagen
1st May 2011, 07:51
This is not a stand-alone application! It's a class that you can include in your app. There is an example

umen
1st May 2011, 08:53
ok thanks , now i see

Added after 35 minutes:

Hi , i compiled the source and this is not what i meant , yeah its nice custom tool tip
but its not system tray implementation

Xagen
1st May 2011, 11:38
And what? Just adopt it for what you want. I showed only an example