[Solved] QWebPage::WebAction add own Action to context menu
does anybody know how do I add custom QAction to Standart QWebPage context menu or change attributes of standard one?
I actually need to disable "Go Back" and "Reload" actions. + Enable/or add my own "Sellect All"(and reconnect it to my own slot, because of buggy behavior of standard action if enabled with setContentEditable(true))....
QWebView view = new QWebView();
// This gives Segnebtation fault
QAction test = view->page()->action(QWebPage::SelectAll)->menu()->addAction("Sellect All");
//this does nothing at all
QAction test = view->page()->action(QWebPage::SelectAll);
connect( .... etc...
Just override QWebView::contextMenuEvent. In there, you can check if the menu is swallowed by the QWebPage (swallowContextMenuEvent), get the default one from the page (QWebPage::createStandardContextMenu), modify it, and/or exec the one you want.
Thank you, peppe!
I will try that...
Wroks perfect! Thanks!