Is it possible to have an animated QSystemTrayIcon?

I can not find information about this. but many kde applications use animated icons.

Since I know that it is set as QIcon, the gif will not work, since only the first frame will be displayed.

+4
source share
2 answers

I have not tried this, but perhaps it is possible by setting a new icon every few milliseconds.

/* list of frames */ QLinkedList<QIcon> frames; /* frames are icons created from images in application resources */ frames <&lt QIcon(":/images/icon1.png") <&lt QIcon(":/images/icon2.png"); /* set timer */ QTimer timer = new QTimer(this); timer->setSingleShot(false); connect(timer, SIGNAL(timeout()), this, SLOT(updateTrayIcon())); timer->start(500); /* update icon every 500 milliseconds */ /* updateTrayIcon function (SLOT) sets next tray icon (ie iterates through QLinkedList frames) */ 
+3
source

I assume you have two ways:

  • Try using an animated GIF (start playing with GIF using QMovie ) and put it in the tray (i "Not sure about this"

  • Another way is to use QTimer and several different images. Here I found an example .

+1
source

All Articles