[Qt-interest] Iaaue with mouseGrabber

Bo Thorsen bo at fioniasoftware.dk
Mon Jul 25 22:05:40 CEST 2011


Den 25-07-2011 13:28, nandita-a.mehta at nokia.com skrev:
> In my application i need to know which widget received the mouse click
> and for that I am using mouseGrabber().

Don't *ever* grab the mouse. Over 14 years of Qt coding and consulting, 
I have only seen one or two cases where it made sense. It's a clear 
indication you are doing something wrong.

In this case, the solution is to set an event filter on 
QApplication::instance. You can see a similar idea on this page in my blog:

http://www.fioniasoftware.dk/blog/?p=8

You can do exactly the same as this shootabug does, just don't check for 
the ctrl key.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Qt-interest-old mailing list