Send touch update events to widget if there is a gesture pending for it.

Otherwise, touch update/end events were ignored and the gestures
were never triggered (unless a native widget was used).

Task-number: QTBUG-37759

Change-Id: I4b0145ffe535065e1458164b67bc8d9e33a4af97
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Friedemann Kleint 2014-03-27 12:21:42 +01:00 committed by The Qt Project
parent 4a46b15514
commit 18a444c330
3 changed files with 12 additions and 1 deletions

View File

@ -3973,7 +3973,11 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
break;
}
default:
if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) {
if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)
#ifndef QT_NO_GESTURES
|| QGestureManager::gesturePending(widget)
#endif
) {
if (touchEvent.type() == QEvent::TouchEnd)
widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false);
if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted())

View File

@ -718,6 +718,12 @@ void QGestureManager::recycle(QGesture *gesture)
}
}
bool QGestureManager::gesturePending(QObject *o)
{
const QGestureManager *gm = QGestureManager::instance();
return gm && gm->m_gestureOwners.key(o);
}
QT_END_NAMESPACE
#endif // QT_NO_GESTURES

View File

@ -81,6 +81,7 @@ public:
#endif //QT_NO_GRAPHICSVIEW
static QGestureManager* instance(); // declared in qapplication.cpp
static bool gesturePending(QObject *o);
void cleanupCachedGestures(QObject *target, Qt::GestureType type);