Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, October 2007
drawing on the icon of a QSystemTray object


Message 1 in thread

Good evening to all.
I would like to draw a couple of rectangles over the icon of a QSystemTray
Object, representing the throughput of the network.

A timer will read the data which represent the network statistics and
will produce a rectangle on the SystemTray whose height should be
proportional to the statistics.

How can i draw the rectangle?

Should i create a class inheriting from a QSystemTray and a QWidget and
reimplement the paintEvent to draw the rectangle?

At every timer timeout(), if i repaint() the SystemTray, will the previous
drawn rectangle be deleted and the new one painted?

Thanks for any hint.

Giacomo

-- 
 [ signature omitted ] 

Message 2 in thread

Giacomo wrote:
> Good evening to all.
> I would like to draw a couple of rectangles over the icon of a QSystemTray
> Object, representing the throughput of the network.
> 
> A timer will read the data which represent the network statistics and
> will produce a rectangle on the SystemTray whose height should be
> proportional to the statistics.
> 
> How can i draw the rectangle?
> 

The size of the icon for the system tray differs from system to system. 
As a result, draw whatever you want on a large QPixmap/QImage (100x100 
maybe). Convert it into a QIcon. Then, QSystemTrayIcon::setIcon(icon) in 
your timeout code. QSystemTrayIcon will use QIcon to get the appropriate 
scaled down size.

Girish

--
 [ signature omitted ]