diff --git a/articlewebview.cc b/articlewebview.cc index b1a0e03b..9c9ad388 100644 --- a/articlewebview.cc +++ b/articlewebview.cc @@ -73,12 +73,10 @@ bool ArticleWebView::eventFilter(QObject *obj, QEvent *ev) if (ev->type() == QEvent::Wheel) { QWheelEvent *pe = static_cast(ev); wheelEvent(pe); - //return true; } if (ev->type() == QEvent::FocusIn) { QFocusEvent *pe = static_cast(ev); focusInEvent(pe); - //return true; } return QWebEngineView::eventFilter(obj, ev); @@ -99,13 +97,14 @@ void ArticleWebView::singleClickAction(QObject* obj, QMouseEvent * event ) if (selectionBySingleClick) { findText(""); // clear the selection first, if any + //send dbl click event twice? send one time seems not work .weird really. need further investigate. + sendCustomMouseEvent(obj, QEvent::MouseButtonDblClick, event); sendCustomMouseEvent(obj, QEvent::MouseButtonDblClick, event); - sendCustomMouseEvent(obj, QEvent::MouseButtonRelease, event); } } void ArticleWebView::sendCustomMouseEvent(QObject* obj,QEvent::Type type,QMouseEvent * event){ - QMouseEvent ev( QEvent::MouseButtonDblClick,mapFromGlobal(QCursor::pos()),mapFromGlobal(QCursor::pos()),QCursor::pos(), Qt::LeftButton, Qt::LeftButton, event->modifiers(), Qt::MouseEventSynthesizedByApplication ); + QMouseEvent ev( type,mapFromGlobal(QCursor::pos()),mapFromGlobal(QCursor::pos()),QCursor::pos(), Qt::LeftButton, Qt::LeftButton, event->modifiers(), Qt::MouseEventSynthesizedByApplication ); QApplication::sendEvent(obj, &ev ); }