My application consists of a WebView widget. A mouse click on the widget is not handled by the mousePressEvent() of my application, but by the WebView widget. So, I installed an event filter to receive the events. Now, I get notified of all events, except the mouseReleaseEvent for the right click (Everything works fine for left clicks and mousePressEvent for the right click is also getting registered). I guess it has got something to do with context events getting generated by right clicks (a pop-up menu gets generated). But since I am using a filter, the event should first be sent to me. The following is the code for the event filter

Qt Code:
  1. public boolean eventFilter(QObject o,QEvent event)
  2. {
  3. if (event.type()==QEvent.Type.MouseButtonPress) // One can call the mousePressEvent() functions from here,which can do this work but speed
  4. {
  5. if (((QMouseEvent)event).button()==Qt.MouseButton.LeftButton)
  6. {
  7. mousebuttontype=1;
  8. clickedorpressed=1;
  9. }
  10. else
  11. if (((QMouseEvent)event).button()==Qt.MouseButton.RightButton)
  12. {
  13. mousebuttontype=2;
  14. System.out.println("right");
  15. }
  16. t1=QTime.currentTime();
  17. t1.start();
  18. }
  19. else
  20. if (event.type()==QEvent.Type.MouseButtonRelease)
  21. {
  22. if (t1.elapsed()>900)
  23. {
  24. switch(mousebuttontype)
  25. {
  26. case 1: browser.back();
  27. break;
  28. case 2: browser.forward();
  29. break;
  30. }
  31. }System.out.println("choda");
  32. }
  33.  
  34. return false;
  35. }
To copy to clipboard, switch view to plain text mode 

On a right click, I get the message "right" but on releasing, I don't get "choda". I get both the messages for left clicks.