Hi,

I have been trying to disable the right click "reload" menu on QWebView. After many failed attempts I tried the following code:

Qt Code:
  1. MyApplication::MyApplication(int argc, char *argv[]) :
  2. QApplication(argc, argv)
  3. {
  4. installEventFilter(this);
  5. }
  6.  
  7. bool MyApplication::eventFilter(QObject *obj, QEvent *e)
  8. {
  9. if ( ( e->type() == QEvent::MouseButtonPress )||
  10. ( e->type() == QEvent::MouseButtonRelease )||
  11. ( e->type() == QEvent::MouseButtonDblClick ) )
  12. {
  13. return true;
  14. //QMouseEvent* m = static_cast<QMouseEvent *>(e);
  15. //int i = m->button();
  16. //if ( i == Qt::RightButton)
  17. //{
  18. // return true;
  19. //}
  20. }
  21. else if ( e->type() == QEvent::KeyPress )
  22. {
  23. QKeyEvent* k = static_cast<QKeyEvent *>(e);
  24. if(k->key() == Qt::Key_F4)
  25. {
  26. quit();
  27. return true;
  28. }
  29. }
  30. return QApplication::eventFilter(obj, e);
  31. }
To copy to clipboard, switch view to plain text mode 

The strange thing is even though the mouse button events are disabled, still the "reload" menu shows up on the QWebView. I tired to inherit the QwebView and install my event filter also but with the same result. I think I missing something about this "reload" menu on QwebView.

Anyone, please let me know if you know of a way to disable the right click "reload" menu on QWebView. Thank you.

Sky.