QWebView Mouse click on scroll bar
-
Setup:
I have created a "MyWebView" class by inheriting from QWebView. I have also re-implemented the "mouseDoubleClikEvent()" of QWebView in which enlarged webview widget will be opened[working fine].
By default MyWebView will load the page "google.com" and if user double click on the web view it loads "wikipedia.com". This is working as expected.Issue:
If I double click on any of the scroll bar or double click on the arrows associated with these scroll bars then I can see that the "mouseDoubleClikEvent" is getting executed.
Is there anyway I can prevent this calling on "mouseDoubleClikEvent" when user clicks on ScrollBars? I want the "mouseDoubleClikEvent" should get called only if user double clicks inside the webview.
Sample code:
mywebview.h
@
#ifndef MYWEBVIEW_H
#define MYWEBVIEW_H#include <QtWebKit/QWebView>
class MyWebView : public QWebView
{
Q_OBJECTpublic:
MyWebView(QWebView *parent = 0);
~MyWebView();protected:
void mouseDoubleClickEvent(QMouseEvent *event);
};#endif // MYWEBVIEW_H
@mywebview.cpp
@
#include "mywebview.h"
#include <QWebFrame>MyWebView::MyWebView(QWebView *parent)
: QWebView(parent)
{
setUrl(QUrl("http://google.co.in"));
}MyWebView::~MyWebView()
{}
void MyWebView::mouseDoubleClickEvent(QMouseEvent *event)
{
setUrl(QUrl("http://wikipedia.org"));
}@