[Qt-interest] How to handle the event filter in Qt graphicsview

Ramesh ramesh.bs at robosoftin.com
Fri Jul 23 07:54:18 CEST 2010


Ya, I do agree but some time we really need event filter to avoid the
unnecessary code block.

Suppose if a view has more than one widget and we need to handle the
keyboard events for all the widgets,
In this situation, overriding the keyboard events for a view doesn't work
and for this we need to override key events for all the child widgets its
cumbersome job.


-----Original Message-----
From: Anders Bakken [mailto:anders.bakken at myriadgroup.com]
Sent: Friday, July 23, 2010 3:34 AM
To: Ross Bencina
Cc: Ramesh; qt-interest at trolltech.com
Subject: Re: [Qt-interest] How to handle the event filter in Qt graphicsview

On Thu, Jul 22, 2010 at 04:21:02PM +0100, Ross Bencina wrote:
> Hi Ramesh
>
> From memory the elastic nodes example has some keyboard event
> handling. Perhaps look at that.
>
> I think the easiest thing would be to override the standard keyboard
> event handlers in a QGraphicsVIew subclass.
>
> Ross.

There's a ton of ways to do it really. You could implement the event
handlers in each item, in the scene, in the view or using an
eventfilter on either the view or the scene.

Most times I'd say it's cleaner to not use an eventfilter and most times
I'd recommend using the event handlers in the items or in the scene
simply because that's likely to be closer to the logic of your app
than the view but these are just my preferences.

--
Anders Bakken

This message, including attachments, is intended solely for the addressee
indicated in this message and is strictly confidential or otherwise
privileged. If you are not the intended recipient (or responsible for
delivery of the message to such person) : - (1) please immediately (i)
notify the sender by reply email and (ii) delete this message and
attachments, - (2) any use, copy or dissemination of this transmission is
strictly prohibited. If you or your employer does not consent to Internet
email messages of this kind, please advise Myriad Group AG by reply e-mail
immediately. Opinions, conclusions and other information expressed in this
message are not given or endorsed by Myriad Group AG unless otherwise
indicated by an authorized representative independent of this message.


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.



More information about the Qt-interest-old mailing list