Prevent timestamps in widgets' touch events from disappearing

Change-Id: I096914eb2b02ad9c4a5c0462a1f4b76ef17c3957
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Laszlo Agocs 2011-11-04 14:22:30 +02:00 committed by Qt by Nokia
parent 52df233a33
commit 0008428f90
6 changed files with 54 additions and 40 deletions

View File

@ -65,7 +65,8 @@ QT_MODULE(Test)
#ifdef QT_WIDGETS_LIB #ifdef QT_WIDGETS_LIB
extern Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, extern Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
QTouchEvent::DeviceType deviceType, QTouchEvent::DeviceType deviceType,
const QList<QTouchEvent::TouchPoint> &touchPoints); const QList<QTouchEvent::TouchPoint> &touchPoints,
ulong timestamp);
#endif #endif
namespace QTest namespace QTest
@ -141,7 +142,7 @@ namespace QTest
#ifdef QT_WIDGETS_LIB #ifdef QT_WIDGETS_LIB
else if (targetWidget) else if (targetWidget)
{ {
qt_translateRawTouchEvent(targetWidget, deviceType, points.values()); qt_translateRawTouchEvent(targetWidget, deviceType, points.values(), 0);
} }
#endif #endif
} }

View File

@ -5215,7 +5215,8 @@ int QApplicationPrivate::findClosestTouchPointId(const QPointF &screenPos)
void QApplicationPrivate::translateRawTouchEvent(QWidget *window, void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QTouchEvent::DeviceType deviceType, QTouchEvent::DeviceType deviceType,
const QList<QTouchEvent::TouchPoint> &touchPoints) const QList<QTouchEvent::TouchPoint> &touchPoints,
ulong timestamp)
{ {
QApplicationPrivate *d = self; QApplicationPrivate *d = self;
typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
@ -5352,6 +5353,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
it.value().first, it.value().first,
it.value().second); it.value().second);
updateTouchPointsForWidget(widget, &touchEvent); updateTouchPointsForWidget(widget, &touchEvent);
touchEvent.setTimestamp(timestamp);
switch (touchEvent.type()) { switch (touchEvent.type()) {
case QEvent::TouchBegin: case QEvent::TouchBegin:
@ -5374,10 +5376,11 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
} }
Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window, Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window,
QTouchEvent::DeviceType deviceType, QTouchEvent::DeviceType deviceType,
const QList<QTouchEvent::TouchPoint> &touchPoints) const QList<QTouchEvent::TouchPoint> &touchPoints,
ulong timestamp)
{ {
QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints, timestamp);
} }
#ifndef QT_NO_GESTURES #ifndef QT_NO_GESTURES

View File

@ -499,7 +499,8 @@ public:
void removeTouchPoint(int touchPointId); void removeTouchPoint(int touchPointId);
static void translateRawTouchEvent(QWidget *widget, static void translateRawTouchEvent(QWidget *widget,
QTouchEvent::DeviceType deviceType, QTouchEvent::DeviceType deviceType,
const QList<QTouchEvent::TouchPoint> &touchPoints); const QList<QTouchEvent::TouchPoint> &touchPoints,
ulong timestamp);
#if defined(Q_WS_WIN) #if defined(Q_WS_WIN)
static bool HasTouchSupport; static bool HasTouchSupport;

View File

@ -289,7 +289,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
void QWidgetWindow::handleTouchEvent(QTouchEvent *event) void QWidgetWindow::handleTouchEvent(QTouchEvent *event)
{ {
QApplicationPrivate::translateRawTouchEvent(m_widget, event->deviceType(), event->touchPoints()); QApplicationPrivate::translateRawTouchEvent(m_widget, event->deviceType(), event->touchPoints(), event->timestamp());
} }
void QWidgetWindow::handleKeyEvent(QKeyEvent *event) void QWidgetWindow::handleKeyEvent(QKeyEvent *event)

View File

@ -50,6 +50,7 @@ public:
bool seenTouchBegin, seenTouchUpdate, seenTouchEnd; bool seenTouchBegin, seenTouchUpdate, seenTouchEnd;
bool acceptTouchBegin, acceptTouchUpdate, acceptTouchEnd; bool acceptTouchBegin, acceptTouchUpdate, acceptTouchEnd;
bool deleteInTouchBegin, deleteInTouchUpdate, deleteInTouchEnd; bool deleteInTouchBegin, deleteInTouchUpdate, deleteInTouchEnd;
ulong timestamp;
tst_QTouchEventWidget() tst_QTouchEventWidget()
: QWidget() : QWidget()
@ -76,6 +77,7 @@ public:
if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin"); if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin");
seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd; seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd;
touchBeginPoints = static_cast<QTouchEvent *>(event)->touchPoints(); touchBeginPoints = static_cast<QTouchEvent *>(event)->touchPoints();
timestamp = static_cast<QTouchEvent *>(event)->timestamp();
event->setAccepted(acceptTouchBegin); event->setAccepted(acceptTouchBegin);
if (deleteInTouchBegin) if (deleteInTouchBegin)
delete this; delete this;
@ -85,6 +87,7 @@ public:
if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate"); if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate");
seenTouchUpdate = seenTouchBegin && !seenTouchEnd; seenTouchUpdate = seenTouchBegin && !seenTouchEnd;
touchUpdatePoints = static_cast<QTouchEvent *>(event)->touchPoints(); touchUpdatePoints = static_cast<QTouchEvent *>(event)->touchPoints();
timestamp = static_cast<QTouchEvent *>(event)->timestamp();
event->setAccepted(acceptTouchUpdate); event->setAccepted(acceptTouchUpdate);
if (deleteInTouchUpdate) if (deleteInTouchUpdate)
delete this; delete this;
@ -94,6 +97,7 @@ public:
if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd"); if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd");
seenTouchEnd = seenTouchBegin && !seenTouchEnd; seenTouchEnd = seenTouchBegin && !seenTouchEnd;
touchEndPoints = static_cast<QTouchEvent *>(event)->touchPoints(); touchEndPoints = static_cast<QTouchEvent *>(event)->touchPoints();
timestamp = static_cast<QTouchEvent *>(event)->timestamp();
event->setAccepted(acceptTouchEnd); event->setAccepted(acceptTouchEnd);
if (deleteInTouchEnd) if (deleteInTouchEnd)
delete this; delete this;
@ -572,13 +576,16 @@ void tst_QTouchEvent::basicRawEventTranslation()
rawTouchPoint.setState(Qt::TouchPointPressed); rawTouchPoint.setState(Qt::TouchPointPressed);
rawTouchPoint.setScreenPos(screenPos); rawTouchPoint.setScreenPos(screenPos);
rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry)); rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
const ulong timestamp = 1234;
qt_translateRawTouchEvent(&touchWidget, qt_translateRawTouchEvent(&touchWidget,
QTouchEvent::TouchScreen, QTouchEvent::TouchScreen,
QList<QTouchEvent::TouchPoint>() << rawTouchPoint); QList<QTouchEvent::TouchPoint>() << rawTouchPoint,
timestamp);
QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchBeginPoints.count(), 1); QCOMPARE(touchWidget.touchBeginPoints.count(), 1);
QCOMPARE(touchWidget.timestamp, timestamp);
QTouchEvent::TouchPoint touchBeginPoint = touchWidget.touchBeginPoints.first(); QTouchEvent::TouchPoint touchBeginPoint = touchWidget.touchBeginPoints.first();
QCOMPARE(touchBeginPoint.id(), rawTouchPoint.id()); QCOMPARE(touchBeginPoint.id(), rawTouchPoint.id());
QCOMPARE(touchBeginPoint.state(), rawTouchPoint.state()); QCOMPARE(touchBeginPoint.state(), rawTouchPoint.state());
@ -605,7 +612,8 @@ void tst_QTouchEvent::basicRawEventTranslation()
rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry)); rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, qt_translateRawTouchEvent(&touchWidget,
QTouchEvent::TouchScreen, QTouchEvent::TouchScreen,
QList<QTouchEvent::TouchPoint>() << rawTouchPoint); QList<QTouchEvent::TouchPoint>() << rawTouchPoint,
0);
QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
@ -636,7 +644,8 @@ void tst_QTouchEvent::basicRawEventTranslation()
rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry)); rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, qt_translateRawTouchEvent(&touchWidget,
QTouchEvent::TouchScreen, QTouchEvent::TouchScreen,
QList<QTouchEvent::TouchPoint>() << rawTouchPoint); QList<QTouchEvent::TouchPoint>() << rawTouchPoint,
0);
QVERIFY(touchWidget.seenTouchBegin); QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate); QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(touchWidget.seenTouchEnd); QVERIFY(touchWidget.seenTouchEnd);
@ -700,7 +709,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
rawTouchPoints[1].setState(Qt::TouchPointPressed); rawTouchPoints[1].setState(Qt::TouchPointPressed);
rawTouchPoints[1].setScreenPos(rightScreenPos); rawTouchPoints[1].setScreenPos(rightScreenPos);
rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry)); rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints, 0);
QVERIFY(!touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
@ -761,7 +770,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
rawTouchPoints[1].setState(Qt::TouchPointMoved); rawTouchPoints[1].setState(Qt::TouchPointMoved);
rawTouchPoints[1].setScreenPos(centerScreenPos); rawTouchPoints[1].setScreenPos(centerScreenPos);
rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry)); rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints, 0);
QVERIFY(!touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
@ -822,7 +831,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
rawTouchPoints[1].setState(Qt::TouchPointReleased); rawTouchPoints[1].setState(Qt::TouchPointReleased);
rawTouchPoints[1].setScreenPos(centerScreenPos); rawTouchPoints[1].setScreenPos(centerScreenPos);
rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry)); rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints, 0);
QVERIFY(!touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
@ -915,7 +924,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
rawTouchPoints[1].setState(Qt::TouchPointPressed); rawTouchPoints[1].setState(Qt::TouchPointPressed);
rawTouchPoints[1].setScreenPos(rightScreenPos); rawTouchPoints[1].setScreenPos(rightScreenPos);
rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry)); rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchPad, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchPad, rawTouchPoints, 0);
QVERIFY(!touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
@ -976,7 +985,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
rawTouchPoints[1].setState(Qt::TouchPointMoved); rawTouchPoints[1].setState(Qt::TouchPointMoved);
rawTouchPoints[1].setScreenPos(centerScreenPos); rawTouchPoints[1].setScreenPos(centerScreenPos);
rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry)); rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchPad, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchPad, rawTouchPoints, 0);
QVERIFY(!touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
@ -1037,7 +1046,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
rawTouchPoints[1].setState(Qt::TouchPointReleased); rawTouchPoints[1].setState(Qt::TouchPointReleased);
rawTouchPoints[1].setScreenPos(centerScreenPos); rawTouchPoints[1].setScreenPos(centerScreenPos);
rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry)); rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchPad, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchPad, rawTouchPoints, 0);
QVERIFY(!touchWidget.seenTouchBegin); QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate); QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd); QVERIFY(!touchWidget.seenTouchEnd);
@ -1295,20 +1304,20 @@ void tst_QTouchEvent::deleteInRawEventTranslation()
rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].pos(), screenGeometry)); rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].pos(), screenGeometry));
// generate begin events on all widgets, the left widget should die // generate begin events on all widgets, the left widget should die
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints, 0);
QVERIFY(pl.isNull() && !pc.isNull() && !pr.isNull()); QVERIFY(pl.isNull() && !pc.isNull() && !pr.isNull());
// generate update events on all widget, the center widget should die // generate update events on all widget, the center widget should die
rawTouchPoints[0].setState(Qt::TouchPointMoved); rawTouchPoints[0].setState(Qt::TouchPointMoved);
rawTouchPoints[1].setState(Qt::TouchPointMoved); rawTouchPoints[1].setState(Qt::TouchPointMoved);
rawTouchPoints[2].setState(Qt::TouchPointMoved); rawTouchPoints[2].setState(Qt::TouchPointMoved);
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints, 0);
// generate end events on all widget, the right widget should die // generate end events on all widget, the right widget should die
rawTouchPoints[0].setState(Qt::TouchPointReleased); rawTouchPoints[0].setState(Qt::TouchPointReleased);
rawTouchPoints[1].setState(Qt::TouchPointReleased); rawTouchPoints[1].setState(Qt::TouchPointReleased);
rawTouchPoints[2].setState(Qt::TouchPointReleased); rawTouchPoints[2].setState(Qt::TouchPointReleased);
qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints); qt_translateRawTouchEvent(&touchWidget, QTouchEvent::TouchScreen, rawTouchPoints, 0);
} }
void tst_QTouchEvent::crashInQGraphicsSceneAfterNotHandlingTouchBegin() void tst_QTouchEvent::crashInQGraphicsSceneAfterNotHandlingTouchBegin()

View File

@ -1941,22 +1941,22 @@ void tst_QApplication::touchEventPropagation()
TouchEventPropagationTestWidget window; TouchEventPropagationTestWidget window;
window.setObjectName("1. window"); window.setObjectName("1. window");
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(!window.seenTouchEvent); QVERIFY(!window.seenTouchEvent);
QVERIFY(!window.seenMouseEvent); QVERIFY(!window.seenMouseEvent);
window.reset(); window.reset();
window.setAttribute(Qt::WA_AcceptTouchEvents); window.setAttribute(Qt::WA_AcceptTouchEvents);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(window.seenTouchEvent); QVERIFY(window.seenTouchEvent);
QVERIFY(!window.seenMouseEvent); QVERIFY(!window.seenMouseEvent);
window.reset(); window.reset();
window.acceptTouchEvent = true; window.acceptTouchEvent = true;
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(window.seenTouchEvent); QVERIFY(window.seenTouchEvent);
QVERIFY(!window.seenMouseEvent); QVERIFY(!window.seenMouseEvent);
} }
@ -1968,8 +1968,8 @@ void tst_QApplication::touchEventPropagation()
TouchEventPropagationTestWidget widget(&window); TouchEventPropagationTestWidget widget(&window);
widget.setObjectName("2. widget"); widget.setObjectName("2. widget");
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(!widget.seenTouchEvent); QVERIFY(!widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent); QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent); QVERIFY(!window.seenTouchEvent);
@ -1978,8 +1978,8 @@ void tst_QApplication::touchEventPropagation()
window.reset(); window.reset();
widget.reset(); widget.reset();
widget.setAttribute(Qt::WA_AcceptTouchEvents); widget.setAttribute(Qt::WA_AcceptTouchEvents);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(widget.seenTouchEvent); QVERIFY(widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent); QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent); QVERIFY(!window.seenTouchEvent);
@ -1988,8 +1988,8 @@ void tst_QApplication::touchEventPropagation()
window.reset(); window.reset();
widget.reset(); widget.reset();
widget.acceptMouseEvent = true; widget.acceptMouseEvent = true;
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(widget.seenTouchEvent); QVERIFY(widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent); QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent); QVERIFY(!window.seenTouchEvent);
@ -1998,8 +1998,8 @@ void tst_QApplication::touchEventPropagation()
window.reset(); window.reset();
widget.reset(); widget.reset();
widget.acceptTouchEvent = true; widget.acceptTouchEvent = true;
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(widget.seenTouchEvent); QVERIFY(widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent); QVERIFY(!widget.seenMouseEvent);
QVERIFY(!window.seenTouchEvent); QVERIFY(!window.seenTouchEvent);
@ -2009,8 +2009,8 @@ void tst_QApplication::touchEventPropagation()
widget.reset(); widget.reset();
widget.setAttribute(Qt::WA_AcceptTouchEvents, false); widget.setAttribute(Qt::WA_AcceptTouchEvents, false);
window.setAttribute(Qt::WA_AcceptTouchEvents); window.setAttribute(Qt::WA_AcceptTouchEvents);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(!widget.seenTouchEvent); QVERIFY(!widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent); QVERIFY(!widget.seenMouseEvent);
QVERIFY(window.seenTouchEvent); QVERIFY(window.seenTouchEvent);
@ -2019,8 +2019,8 @@ void tst_QApplication::touchEventPropagation()
window.reset(); window.reset();
widget.reset(); widget.reset();
window.acceptTouchEvent = true; window.acceptTouchEvent = true;
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(!widget.seenTouchEvent); QVERIFY(!widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent); QVERIFY(!widget.seenMouseEvent);
QVERIFY(window.seenTouchEvent); QVERIFY(window.seenTouchEvent);
@ -2030,8 +2030,8 @@ void tst_QApplication::touchEventPropagation()
widget.reset(); widget.reset();
widget.acceptMouseEvent = true; // doesn't matter, touch events are propagated first widget.acceptMouseEvent = true; // doesn't matter, touch events are propagated first
window.acceptTouchEvent = true; window.acceptTouchEvent = true;
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, pressedTouchPoints, 0);
qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints); qt_translateRawTouchEvent(&window, QTouchEvent::TouchScreen, releasedTouchPoints, 0);
QVERIFY(!widget.seenTouchEvent); QVERIFY(!widget.seenTouchEvent);
QVERIFY(!widget.seenMouseEvent); QVERIFY(!widget.seenMouseEvent);
QVERIFY(window.seenTouchEvent); QVERIFY(window.seenTouchEvent);