C++/QWebEngineView: How to obtain the link clicked by "right-click" + "open in new tab"?



  • In QWebEngineView: How to obtain the link clicked by "right-click" + "open in new tab"?

    Actually I've succeded to catch the action of "open in new tab" (after right-click) by doing this:

    QAction* openInNewTab = view->pageAction(QWebEnginePage::OpenLinkInNewTab);
    connect(openInNewTab, SIGNAL(triggered()), this, SLOT(on_actionNewTab_triggered()));
    

    But in my slot on_actionNewTab_triggered(), I have no possibility to know which url to load. I tried to know if there is something in the data of QAction*

    QVariant va;
    QAction* action = (QAction*)  sender();
    va = action->data();
    

    but the data (va) contains no url !


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.