OK.
The eventFilter function does exactly what it's name suggests - it FILTERS events - meaning that if you don't want a certain event to reach certain widget, you catch it it.
The function that handles all events is QObject::event(). Here all events are passed and they are forwarded to the more specialized event handlers ( like mousePressEvent, keyPressEvent, etc ).
The events go first through event filter, then in the event().
So, you should not use eventFilter, unless you want to filter some events.
I believe you should take a look in Assistant at eventFilter() and event().
Anyway, accepting the mouse events in the event filter makes the event handlers you created useless because they will not be called.
I assume that you are coming from a long programming period in MFC.
You shouldn't care about other events, other than mouse move, etc. If you don't need an event, then leave it alone, because you risk having unpredicted behavior in your app ( even if it works well a few times ).
Conclusion: eventFilter is used to filter( read select, catch ) certain events.
event() & friends ( mouseMoveEvent, etc ) is used to actually do something when that certain event is sent to your widget. You may choose to accept it( don't forward it to children ) or reject it.
However, the recommended approach is to use the specialized event handlers. Every event has a specialized event handler.
Regards




.
Reply With Quote
Bookmarks