Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to add dynamic icons to an application



  • Hi, I need to add icons to my application to dynamically show the status of devices such as WiFi signal, GPS signal, Battery level, etc. I see these icons on devices every day but I am not sure what is the proper way to implement. After spending a lot of time online search, it seems that most cases use a series of static icon files to represent one device status. For example, if the WiFi has 4 bars at full signal strength, then 5 icon files, ( 0 bar, 1 bar, ..., 4 bar) will be used for different status. If this is the case, how the background color of the icon file can match with the application ?

    @@ after testing several image files as the icon, I noticed that the background color match is NOT an issue. Instead resize of the icon could be a problem in some cases. @@

    I also think that I can create a customized widget to work as an icon. Whenever the device status changes, I update the icon widget with its paint event. This method should have higher performance cost than loading static files, I think.

    So what is the proper way for this task ?

    In addition, if you have any source for this kind of work, with or without license, please drop me a link.

    Any advice and source are greatly appreciated!


Log in to reply