PDA

View Full Version : Ignore mouse events out of tree view



krishna.bv
27th December 2006, 06:38
Hi, my application which is a treeview should have a facility of ignoring events outside the tree view.
The mouse click event including right click/single and double click has to be recognised only if that happens on the tree view.

can any one please suggest what to do?

thanks in advance,

regards,
vamsi.

aamer4yu
27th December 2006, 07:17
What things do u have other than the tree view ??
take actions only if mouse was clicked in the tree view.. dont take any action otherwise.

For checking if the mouse was clicked in the tree view, map the cordinates to view and check if it lies within the boundary / geometry of the view.
hope this helps :)

krishna.bv
27th December 2006, 12:07
thank you, presently there is only tree view.
but how to track the tree view, since the view can expand depending on data.

i got what you are saying ...may be a small snippet of code will help alot.

thanks,
krishna.

wysota
27th December 2006, 12:24
But what do you want to do in the first place? Events are ignored by default, so you don't have to do anything to ignore them - just don't handle them... Right clicking is enabled by default only on textual widgets (like QTextEdit), for others you don't have to care.

In general, if you want to filter the events, you can subclass QApplication and reimplement notify() or install an event filter on the application instance object - you can reach all events from the whole application there and stop the ones you don't want propagated.