[Kde-games-devel] accept() mouse events?

Parker Coates parker.coates at kdemail.net
Tue Jun 22 19:33:38 CEST 2010


On Sat, Jun 19, 2010 at 22:35, Ian Wadham wrote:
> On checking I find that KGoldrunner, Kubrick and Kolf contain
> no accept() in their mouse*Event() re-implementations.  So
> they have been vulnerable to Oxygen's new window-move
> feature (click on an "empty" area to move a window), in
> which all play-area widgets were treated as empty.
>
> KJumpingCube has been fixed.  Thanks Parker! ... :-)
>
> But Hugo Periera da Costa says on kde-core-devel that he
> has fixed the problem back in Oxygen and that KJCube is now
> fixed twice.  Should I follow a "braces and belt" procedure
> and put in "accept()" everywhere?
>
> I notice that the doco for QWidget::mouse*Event() says
> nothing about a need to do accept() and the Scribbly example
> does not do it, but the QMouseEvent doco (it must be years
> since I last read it) *does* recommend using accept() or ignore().

Personally, I think it's generally a good idea to accept() events when
appropriate. (As far as I know, explicitly ignore()ing an event is
almost never necessary outside of some advanced use cases.) In
addition to being the more "officially correct" thing to do, I think
it's also useful for readers of your code as you make it explicitly
clear which events you're using and which you want to continue up the
stack. But as you've noticed, in most cases you can get by fine
without doing so.

So basically, don't bother losing any sleep over it, but if you're
feeling ambitious then it certainly wouldn't hurt to add a few
accept() calls.

Parker


More information about the kde-games-devel mailing list