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

Qt-interest Archive, October 2007
Drawing rectangles on a QSystemTrayIcon


Message 1 in thread

Hello!
Thanks to the suggestions you provided, i realized the printing
of a rectangle over the icon of the QSystemTray object.

The code that realizes this is as follows:

        QPixmap pix(ICON_PATH + "ipfire.png");
	QPainter painter(&pix);
	
	if(refresh_no % 5 > 3)
	{
		QRectF rect(0, actualw, actualw/2, -30);
		painter.drawRect(rect);
		painter.fillRect(rect, QBrush(KGREEN, Qt::Dense5Pattern));
	}
	else
	{
		QRectF rect(0, actualw, actualw/2, -15);
		painter.drawRect(rect);
		painter.fillRect(rect, QBrush(KGREEN, Qt::Dense6Pattern));
	}
	QIcon newicon = QIcon(pix);
	setIcon(newicon);

at a certain timeout of a QTimer the pixmap is modified and set again
with setIcon().

The problem is that the icon flickers sometimes when it gets
repainted, and i would like
to avoid this.
Is there anything i can do/modify to achieve a stable picture on the
sistem tray?

Thank you.

Giacomo

-- 
 [ signature omitted ]