Skip to content

Commit fe3cfed

Browse files
committed
added mouse wheel command for QmlWebViewCmdExecutor
1 parent 0d9b4f0 commit fe3cfed

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

inc/extension_qt/qml_web_view_executor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class QmlWebViewCmdExecutor : public ViewCmdExecutor {
5959
virtual void MouseDoubleClick(Error** error);
6060
virtual void MouseButtonUp(Error** error);
6161
virtual void MouseButtonDown(Error** error);
62-
virtual void MouseClick(MouseButton button, Error** error);
62+
virtual void MouseClick(MouseButton button, Error** error);
63+
virtual void MouseWheel(const int delta, Error **error);
6364
virtual void MouseMove(const int x_offset, const int y_offset, Error** error);
6465
virtual void MouseMove(const ElementId& element, int x_offset, const int y_offset, Error** error);
6566
virtual void MouseMove(const ElementId& element, Error** error);

src/webdriver/extension_qt/qml_web_view_executor.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,16 @@ void QmlWebViewCmdExecutor::MouseClick(MouseButton button, Error** error) {
317317
QApplication::postEvent(view_->page(), releaseEvent);
318318
}
319319

320+
void QmlWebViewCmdExecutor::MouseWheel(const int delta, Error **error) {
321+
CHECK_VIEW_EXISTANCE
322+
323+
QPoint point = QCommonUtil::ConvertPointToQPoint(session_->get_mouse_position());
324+
325+
QWheelEvent *wheelEvent = new QWheelEvent(point, delta, Qt::NoButton, Qt::NoModifier);
326+
327+
QApplication::postEvent(view_->page(), wheelEvent);
328+
}
329+
320330
void QmlWebViewCmdExecutor::MouseMove(const int x_offset, const int y_offset, Error** error) {
321331
CHECK_VIEW_EXISTANCE
322332

0 commit comments

Comments
 (0)