diff options
Diffstat (limited to 'tests/auto/gestures')
-rw-r--r-- | tests/auto/gestures/tst_gestures.cpp | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 9ab252a..9639fb0 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -779,110 +779,6 @@ void tst_Gestures::overlappingGraphicsItems() QVERIFY(item->gesture.last.singleshot.delivered); } -namespace QTest -{ - - class QTouchEventSequence - { - public: - QTouchEventSequence(QWidget *widget) - : relativeWindow(widget) - { - ++refcount; - } - QTouchEventSequence(const QTouchEventSequence &v) - : relativeWindow(v.relativeWindow) - { - ++refcount; - } - ~QTouchEventSequence() - { - if (!--refcount) { - commit(); - foreach(QTouchEvent::TouchPoint *pt, points) - delete pt; - points.clear(); - } - } - QTouchEventSequence& press(int touchId, const QPoint &pt) - { - touchPointStates |= Qt::TouchPointPressed; - QTouchEvent::TouchPoint *p = point(touchId); - p->setStartPos(pt); - p->setStartScreenPos(relativeWindow->mapToGlobal(pt)); - p->setLastPos(pt); - p->setLastScreenPos(relativeWindow->mapToGlobal(pt)); - p->setPos(pt); - p->setScreenPos(relativeWindow->mapToGlobal(pt)); - p->setState(Qt::TouchPointPressed); - return *this; - } - QTouchEventSequence& move(int touchId, const QPoint &pt) - { - touchPointStates |= Qt::TouchPointMoved; - QTouchEvent::TouchPoint *p = point(touchId); - p->setLastPos(p->pos()); - p->setLastScreenPos(relativeWindow->mapToGlobal(p->pos().toPoint())); - p->setPos(pt); - p->setScreenPos(relativeWindow->mapToGlobal(pt)); - p->setState(Qt::TouchPointMoved); - return *this; - } - QTouchEventSequence& release(int touchId, const QPoint &pt) - { - touchPointStates |= Qt::TouchPointReleased; - QTouchEvent::TouchPoint *p = point(touchId); - p->setLastPos(p->pos()); - p->setLastScreenPos(relativeWindow->mapToGlobal(p->pos().toPoint())); - p->setPos(pt); - p->setScreenPos(relativeWindow->mapToGlobal(pt)); - p->setState(Qt::TouchPointReleased); - return *this; - } - QTouchEventSequence& stationary(int touchId) - { - touchPointStates |= Qt::TouchPointStationary; - QTouchEvent::TouchPoint *p = point(touchId); - p->setState(Qt::TouchPointStationary); - return *this; - } - - private: - QTouchEvent::TouchPoint* point(int touchId) - { - QTouchEvent::TouchPoint *pt = points.value(touchId, 0); - if (!pt) { - pt = new QTouchEvent::TouchPoint; - pt->setId(touchId); - points.insert(touchId, pt); - } - return pt; - } - void commit() - { - if (relativeWindow) { - QTouchEvent event(QEvent::RawTouch, Qt::NoModifier, - touchPointStates, points.values()); - ::sendSpontaneousEvent(relativeWindow, &event); - relativeWindow = 0; - } - } - - static int refcount; - QMap<int, QTouchEvent::TouchPoint*> points; - QWidget *relativeWindow; - Qt::TouchPointStates touchPointStates; - friend QTouchEventSequence touchBeginEvent(QWidget*); - }; - int QTouchEventSequence::refcount = 0; - - QTouchEventSequence touchEvent(QWidget *widget) - { - return QTouchEventSequence(widget); - } - -} - void tst_Gestures::touch() { mainWidget->setAttribute(Qt::WA_AcceptTouchEvents); |