Hi Squidge,
Thank you for your suggestion. I implemented it and below is the code. But I was not able to get it to disable the right click on flash videos. And also I ran it through the debugger with a break point in the eventFilter method. And it looks like this eventFilter is never being called.
It looks like as if the events in QT are broadcasted to all the QObjects in the application. Also please do let me know if you know of any good literature that explains qt event mechanism in detail. Thank you.
Sky
: QWebView(parent), m_page(this), m_pXMLHttp(NULL)
{
installEventFilter(this);
setPage(&m_page);
m_pFrame = page()->mainFrame();
m_page.installEventFilter(this);
m_pFrame->installEventFilter(this);
}
{
if ( (event
->type
() == QEvent::MouseButtonPress )||
(event
->type
() == QEvent::MouseButtonRelease)||
( event
->type
() == QEvent::MouseButtonDblClick ) ) {
QMouseEvent *mouseEvent
= static_cast<QMouseEvent
*>
(event
);
if (mouseEvent->button() == Qt::RightButton)
{
mouseEvent->accept();
return true;
}
}
//return QWebView::eventFilter(obj, event);
return false;
}
Browser::Browser(QWidget *parent)
: QWebView(parent), m_page(this), m_pXMLHttp(NULL)
{
installEventFilter(this);
setPage(&m_page);
m_pFrame = page()->mainFrame();
m_page.installEventFilter(this);
m_pFrame->installEventFilter(this);
}
bool Browser::eventFilter(QObject *obj, QEvent *event)
{
if ( (event->type() == QEvent::MouseButtonPress )||
(event->type() == QEvent::MouseButtonRelease)||
( event->type() == QEvent::MouseButtonDblClick ) )
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::RightButton)
{
mouseEvent->accept();
return true;
}
}
//return QWebView::eventFilter(obj, event);
return false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks