[Panel-devel] mousePressEvent() and contentRect()

Sebastian Kuegler sebas at kde.org
Sat Dec 22 12:42:33 CET 2007


On Friday 21 December 2007 16:21:30 Jason Stubbs wrote:
> I've gone through and fixed where I've found the issue, but I'll go over it
> here so that it hopefully doesn't happen again. ;)
>
> When overridding mousePressEvent for a Plasma::Applet, you pretty much
> always want to ignore it if its not within contentRect(). The reason for
> this is that, unlike QWidgets, you will get clicks for the frame as well.
>
> Ordinarily you'll want to ignore these so that the applethandle (or
> whatever else) can recieve and do nice things like allowing the user to
> move the applet. Likewise, be sure to ignore() anything that you are not
> handling, unless you specifically don't want it to be handled.
>
> On the flip side, blindly calling Applet::mousePressEvent() is not a good
> idea either. Calling it in place of ignore() just in case Applet some day
> overrides it is fine, but blindly calling it means that you are ignoring
> all events unless you accept() after the call. This translates to a click
> event being handled by your applet *and* moving of the applet being
> started.
>
> I've fixed the contentRect() issues in the four clocks and the comic
> applet, but haven't touched anything that is calling Applet's
> mousePressEvent because I couldn't tell from a glance what was intended.

Shouldn't this be caught in Applet then, and just passed on to the 
implementation of the applet when it's in the contentRect? Having to handle 
that in each applet respectively sounds like a source of problems for me. The 
applet implementation itself should be ignorant to those Applet-generic 
things, no?
-- 
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20071222/8b2b752c/attachment.pgp 


More information about the Panel-devel mailing list