@@ -2046,19 +2046,26 @@ void Automation::TouchClick(const WebViewId &view_id, const Point &p, Error **er
20462046 touchPoint.setState (Qt::TouchPointPressed);
20472047 touchPoint.setPressure (1 );
20482048 points.append (touchPoint);
2049+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
2050+ QTouchEvent *touchBeginEvent = new QTouchEvent (QEvent::TouchBegin, &touchDevice, Qt::NoModifier, Qt::TouchPointPressed, points);
2051+ #else
20492052 QTouchEvent *touchBeginEvent = new QTouchEvent (QEvent::TouchBegin, QTouchEvent::TouchScreen, Qt::NoModifier, Qt::TouchPointPressed, points);
2050-
2053+ # endif
20512054 points.clear ();
20522055 touchPoint.setPos (point);
20532056 touchPoint.setScreenPos (view->mapToGlobal (point));
20542057 touchPoint.setStartScreenPos (view->mapToGlobal (point));
20552058 touchPoint.setState (Qt::TouchPointReleased);
20562059 touchPoint.setPressure (1 );
20572060 points.append (touchPoint);
2061+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
2062+ QTouchEvent *touchEndEvent = new QTouchEvent (QEvent::TouchEnd, &touchDevice, Qt::NoModifier, Qt::TouchPointReleased, points);
2063+ #else
20582064 QTouchEvent *touchEndEvent = new QTouchEvent (QEvent::TouchEnd, QTouchEvent::TouchScreen, Qt::NoModifier, Qt::TouchPointReleased, points);
2065+ #endif
20592066
20602067 QApplication::postEvent (view, touchBeginEvent);
2061- // QApplication::postEvent(view, touchEndEvent);
2068+ QApplication::postEvent (view, touchEndEvent);
20622069
20632070 // additional we send mouse event for QWebView
20642071 QMouseEvent *pressEvent = new QMouseEvent (QEvent::MouseButtonPress, point, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
@@ -2129,7 +2136,11 @@ void Automation::TouchDown(const WebViewId &view_id, const Point &p, Error **err
21292136 touchPoint.setPressure (1 );
21302137 points.append (touchPoint);
21312138
2139+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
2140+ QTouchEvent *touchBeginEvent = new QTouchEvent (QEvent::TouchBegin, &touchDevice, Qt::NoModifier, Qt::TouchPointPressed, points);
2141+ #else
21322142 QTouchEvent *touchBeginEvent = new QTouchEvent (QEvent::TouchBegin, QTouchEvent::TouchScreen, Qt::NoModifier, Qt::TouchPointPressed, points);
2143+ #endif
21332144
21342145 QApplication::postEvent (view, touchBeginEvent);
21352146
@@ -2154,7 +2165,12 @@ void Automation::TouchUp(const WebViewId &view_id, const Point &p, Error **error
21542165 touchPoint.setPressure (1 );
21552166 points.append (touchPoint);
21562167
2168+
2169+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
2170+ QTouchEvent *touchEndEvent = new QTouchEvent (QEvent::TouchEnd, &touchDevice, Qt::NoModifier, Qt::TouchPointReleased, points);
2171+ #else
21572172 QTouchEvent *touchEndEvent = new QTouchEvent (QEvent::TouchEnd, QTouchEvent::TouchScreen, Qt::NoModifier, Qt::TouchPointReleased, points);
2173+ #endif
21582174
21592175 QApplication::postEvent (view, touchEndEvent);
21602176
@@ -2179,7 +2195,11 @@ void Automation::TouchMove(const WebViewId &view_id, const Point &p, Error **err
21792195 touchPoint.setPressure (1 );
21802196 points.append (touchPoint);
21812197
2198+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
2199+ QTouchEvent *touchMoveEvent = new QTouchEvent (QEvent::TouchUpdate, &touchDevice, Qt::NoModifier, Qt::TouchPointMoved, points);
2200+ #else
21822201 QTouchEvent *touchMoveEvent = new QTouchEvent (QEvent::TouchUpdate, QTouchEvent::TouchScreen, Qt::NoModifier, Qt::TouchPointMoved, points);
2202+ #endif
21832203
21842204 QApplication::postEvent (view, touchMoveEvent);
21852205
0 commit comments