PDA

View Full Version : Disable context menu in QWebView



ivi2501
25th August 2008, 10:42
I use QWebView component and I need use custom menu or disable context meny (menu with review link downloadn image, reload page and other).

I find function
bool swallowContextMenuEvent ( QContextMenuEvent * event )
but I not know how.

aamer4yu
25th August 2008, 11:24
QWebView is inherited from QWidget.
So you can override QWidget::contextMenuEvent and do what you want.

ivi2501
25th August 2008, 12:27
I know this. its works.
But I ask about disable context menu with use only QWebView methots.
but if this impossible np.
Because I create class based on QWebView and redeclare contextMenuEvent ( QContextMenuEvent * event )

and all works fine.



Thanks.

aamer4yu
26th August 2008, 10:59
In that case QWidget::setContextMenuPolicy() might be of some help to you.
You can try setting it to Qt::NoContextMenu and see what happens :)