how to se t the right click operations of a link in qtwebkit

user49557 Source

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.

qt

Answers

answered 7 years ago Koying #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());

comments powered by Disqus