Qt: how to make decorated rich popup window instead the default QSystemTrayIcon popup window
I have simple notification application, and I'm using Qt 4.7.1 with C++ to write an applicatio开发者_如何转开发n that sits in the system tray. Every time a message comes; I need it to pop-up a window. But, I need it to be rich (i.e., I want to add color and pictures to it). However, all I have is the default pop-up message box. How can I create new richer one that will always pop-up above the tray icon?
All the qt widget classes can be styled via stylesheets, depending where create your popup (designer, or in code) assign it a stylesheet with the look that you want it to have. You can test stylesheets in designer by assigning a style to a widget using the context menu of the widget
After further review, the QSystemTrayIcon::showMessage()
call puts up a system notification. Which I don't know if it can be styled. The qsystemtrayicon_win.cpp
file in the qt distribution shows a workaround and shows a way of how to find the location of the icon in the tray (see QSystemTrayIconSys::findIconGeometry
). Once you have the location you could pop up your own window at that location. I did not look to deep, I don't know if you can get to the location for the icon with the information that you have on the public side of Qt. You might have to go all windows with that.
精彩评论