0

How to edit QtWebKit's right-click context menu in Qt Creator? how to get response in QtWebKit https://qt-project.org/forums/viewthread/15149/ i have seen all these threads and more but cant get my anwser i want to set the righ click menu of links images frames etc. in qtwebkit in qwebview i have heard that we have to install an event filter and get the object which is at that position but i am not geting it can you tell me a simple and sweet solution tell how to set the operation of that action also iut would be great if you can give a sample live working code i have heard that we have to use QMenu and QAction for this.

Community
  • 1
  • 1
user49557
  • 132
  • 1
  • 3
  • 11

1 Answers1

1

To get a "standard" menu from QWebView based upon where you clicked, do:

    page()->updatePositionDependentActions(pos);
    QMenu* ctxMenu = page()->createStandardContextMenu();

to know on what you clicked, use

QWebHitTestResult hit = page()->mainFrame()->hitTestContent(pressPoint.toPoint());
Chris Browet
  • 4,156
  • 20
  • 17
  • https://qt-project.org/forums/viewreply/79009/ the final solution written by me with your and others help and by experimenting a lot i have been busy in experimenting these days – user49557 Mar 17 '12 at 16:11
  • Would using the position argument work if the context menu was invoked using the keyboard instead of the mouse? – Ken Kinder Feb 16 '13 at 20:21