Mouseevents on a QwebView or WebEngineView
Im new in this Forum and new to Qt .
On a WebView I try to reimplement a MouseEvent. The Application start without a error but the qDebug message doesn't appear.
Please check my code...
Thanks for help
Webtest.h
Code:
#include <QWidget>
#include <QWebEngineView>
#include <QMouseEvent>
class WebPageMapster : public QWebEngineView
{
public:
WebPageMapster();
~WebPageMapster();
protected:
};
webtest.cpp
Code:
WebPageMapster::WebPageMapster()
{
load
(QUrl("http://google.ch"));
resize(800,600);
show();
}
void WebPageMapster
::mousePressEvent(QMouseEvent *event
){ if (event->button()== Qt::LeftButton){
qDebug() << "Test";
}
}
Re: Mouseevents on a QwebView or WebEngineView
Is the mousePressEvent handler called at all?
Cheers,
_
Re: Mouseevents on a QwebView or WebEngineView
Hi
Yes. on a other Widget I can call the mousePressEvent()
Best
Re: Mouseevents on a QwebView or WebEngineView
No, I meant on the web engine view.
I am asking because QWebEngineView overwrites the event() method (according to the documentation), so it might not call the QWidget event handlers at all.
You can try overwriting event() yourself, checking for the mouse press there and just pass on the even after that.
Cheers,
_
Re: Mouseevents on a QwebView or WebEngineView
I've debuged the Events on the WebEngineView.
Only the Enter Event 10) and the ContextMenu (Event 82,68,69) Events are ermited.
How can Implement those MouseEvents? Or is there a other solution to paint a QRubberband on the WebEngineView by Mouse?
Best
Re: Mouseevents on a QwebView or WebEngineView
You could check the code of QWebEngineView to see how it intercepts the mouse events.
Maybe it uses an event filter and you could install your own "on top" of that.
Cheers,
_