[Qt-interest] QSystemTrayIcon extensibility?
Phil Barila
phil at rebit.com
Thu May 13 00:33:11 CEST 2010
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com]
On Behalf Of Phil Barila
Sent: Friday, May 07, 2010 11:04 PM
To: qt-interest at trolltech.com
Subject: [Qt-interest] QSystemTrayIcon extensibility?
> Hi all,
>
> I'm pretty new at Qt. I'd like to use the QSystemTrayIcon as the basis
> for a user notification widget. As implemented, it seems that the only
> activations available are mouse clicks. I need mouse-overs, too.
>
> I've been examining the QSystemTrayIcon implementation, hoping to find
> a way to enable a callback on mouse-overs. From what I've been able to
> discern, there is no way to do that without code reuse by copy/paste,
> since the interface doesn't only exposes mouse-clicks, and the class
> which implements the Win32 message handler is defined inside the
> qsystemtrayicon_win.cpp file, so it's not easily subclassed.
>
> Am I missing some obvious construct by which I might add mouse-over
> activation? With only a small amount of hackery, I was able to call
> installEventFilter() on the private QSystemTrayIconSys object, but the
> installed filter doesn't get called in a way that is useful for my
> purposes (it really doesn't get called at all). I also called
> setMouseTracking(true) on the sys object, and that was the only event
> that came into my filter, MouseTrackingChange. After all that, I still
> only get my the slot connected to the activated() signal invoked on
> mouse clicks. Unfortunately, it doesn't appear that there is any
> support for signaling mouse-overs in the
> QSystemTrayIconSys::winEvent() routine. Is there another signal I'm
> missing? Is there another API besides installEventFilter() that I
> don't know about that would allow me to register a winEvent callback on
> the sys object (or something)? As I noted above, subclassing
> QSystemTrayIconSys is quite problematic as it is implemented today, and
> will require almost complete copy/paste of the QSystemTrayIcon source
> in order to accomplish that.
>
> I'm also going probably going to need to put up my own balloon, as I'm
> going to need to show custom icons, but that's for later. If someone
> can point me at the right bits to enable the mouse-overs, or confirm
> what I've already discovered, I'll be very grateful.
I'll assume by the silence that this really hasn't been an issue for anyone yet. I did get an out-of-band suggestion from Gordon Schumacher to call the QCoreApplication::setEventFilter(), and that got me a whole lot of window messages, including a lot that aren't directed to the widget. So it's possible to override the default behavior through the QCoreApplication, but it's a pretty blunt instrument compared to overriding the winEvent() as a subclass of the Win32 QSystemTrayIconSys or several other alternatives that readily come to mind.
Since I'm new here, is the probability of the QSystemTrayIcon being modified to add some extensibility in some future release of Qt a number larger than infinitesimally small? How would someone go about asking for that? Or is the answer going to be, "When you do it, please submit your changes for inclusion"? I'm not opposed to any of those, or other possibilities that I didn't suggest, but I'd like to know how to "participate" in the culturally accepted manner of this community.
Thanks,
Phil
Phil Barila | Senior Software Engineer | www.rebit.com | (720) 204-3353 | phil at rebit.com
Computer Times and Dragon Steel Mods Editor's Choice and 2009 CRN Emerging Vendor
More information about the Qt-interest-old
mailing list