[Interest] Does Qt have a cross platform + mobile "QSystemTrayIcon"?

Rutledge Shawn Shawn.Rutledge at digia.com
Thu Oct 3 16:16:32 CEST 2013


On 2 Oct 2013, at 4:40 PM, Joseph Crowell wrote:

> On 02/10/2013 10:33 PM, Mark wrote:
>> On Wed, Oct 2, 2013 at 7:52 AM, Rutledge Shawn <Shawn.Rutledge at digia.com> wrote:
>> 
>> 
>> Ensuring that it works on the mobile platforms too sounds like a good idea, to the extent that it's possible.  But the lifecycle issues might be different, e.g. usually a "background application" can be killed at any time, so should the icon go away when that happens?
>> 
>> I think it should work exactly as you just described it. If one wants to make the icon "persistent" then that would probably have to be done by the developer. This class should not care about that. 

http://developer.android.com/guide/topics/ui/notifiers/notifications.html
http://support.apple.com/kb/HT3576
http://growl.info/
http://www.maketecheasier.com/a-guide-to-kde-notification-system/2011/11/11
http://www.notmart.org/index.php/Software/Notifications,_let_the_redesign_
http://drfav.wordpress.com/2012/09/17/the-notifications-issue-part-3-the-possible-solution/

A notification seems to be a fairly different sort of thing if we try to think of it as a cross-platform concept; they are usually persistent, and often you can re-open the application that triggered it later on (even days later).  The left-side "tray" icon on Android exists only to tell you that you have a notification; the application doesn't create an icon right from the beginning and then display popup balloons later on, the way it does on the Windows tray.  That type of icon is more like the ones on the top right corner on Android (wifi, bluetooth, battery, clock etc.) but I don't find a standard way for an ordinary application to put such an icon there:

http://stackoverflow.com/questions/18350016/how-to-create-a-notification-status-bar-icon-on-the-right-side

> As far as mobile compatibility goes, isn't QSystemTrayIcon QtWidgets based? I believe current advice is to stay away from QtWidgets on mobile platforms.

Well a system tray icon is kindof special, but there's no point in adding a dependency on widgets that you otherwise don't need.  I think maybe we need a new Qt Quick API for notifications (but we haven't promised such a thing AFAIK).  In that case it will of course be independent of widgets.  The functionality we provide should look as normal as possible on mobile devices and desktops.  I just developed the MessageDialog Qt Quick API, but there is also a "Toast" on Android which is just another kind of popup message thing, and a notification is also a simple popup message, but all of these have different features (a MessageDialog can have an icon, up to 3 different pieces of text, and lots of buttons, but a Toast has no buttons, only one piece of text, and dismisses itself, while the notification is persistent until the user dismisses it, even after the app has exited).  There are also the fairly unique push notifications on iOS (the red bubble with a number in it, which can be "pushed" even when the application isn't running).  It's hard to come up with a consistent cross-platform API for all of those, but at least the persistent, text-with-icon, fire-and-forget notification seems to be available on most platforms in one way or another.  Perhaps notifications can be considered more pervasive than tray icons (for ordinary applications, not counting "special" system tools).

I always thought it was a bit arbitrary anyway that every application will show up in the task bar… except a few of them which consider themselves so special that they should reside in the tray instead.  Sometimes they are otherwise ordinary applications which are abusing the tray, because they think it's convenient for the users, or for marketing reasons (start automatically and stay in sight all the time so the user doesn't forget to use it).  Maybe that's the reason why Apple and Google both want to own and control the applications that can create tray icons on their devices.  So how can we have a fully cross-platform API for that?

(Disclaimer: all of the above is my opinion, and subject to discussion; please don't construe as any sort of promise from Digia)


More information about the Interest mailing list