--- src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -709,17 +723,20 @@ public class QtNative } if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN && index == event.getActionIndex()) { return 0; } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP && index == event.getActionIndex()) { return 3; + } else if (action == MotionEvent.ACTION_CANCEL && index == event.getActionIndex()) { + return 4; } return 2; } //@ANDROID-9 --- src/corelib/global/qnamespace.h +++ src/corelib/global/qnamespace.h @@ -1669,11 +1669,12 @@ public: enum TouchPointState { TouchPointPressed = 0x01, TouchPointMoved = 0x02, TouchPointStationary = 0x04, - TouchPointReleased = 0x08 + TouchPointReleased = 0x08, + TouchPointCanceled = 0x10 }; Q_DECLARE_FLAGS(TouchPointStates, TouchPointState) Q_DECLARE_OPERATORS_FOR_FLAGS(TouchPointStates) #ifndef QT_NO_GESTURES --- src/gui/kernel/qwindowsysteminterface.cpp +++ src/gui/kernel/qwindowsysteminterface.cpp @@ -706,13 +706,15 @@ QList *type = QEvent::TouchUpdate; if (states == Qt::TouchPointPressed) *type = QEvent::TouchBegin; else if (states == Qt::TouchPointReleased) *type = QEvent::TouchEnd; + else if (states == Qt::TouchPointCanceled) + *type = QEvent::TouchCancel; } - if (states == Qt::TouchPointReleased) { + if (states == Qt::TouchPointReleased || states == Qt::TouchPointCanceled) { const auto locker = qt_scoped_lock(pointIdMapMutex); // All points on deviceId have been released. // Remove all points associated with that device from g_pointIdMap. // (On other devices, some touchpoints might still be pressed. --- src/plugins/platforms/android/androidjniinput.cpp +++ src/plugins/platforms/android/androidjniinput.cpp @@ -240,10 +298,13 @@ namespace QtAndroidInput state = Qt::TouchPointStationary; break; case 3: state = Qt::TouchPointReleased; break; + case 4: + state = Qt::TouchPointCanceled; + break; } const int dw = desktopWidthPixels(); const int dh = desktopHeightPixels(); QWindowSystemInterface::TouchPoint touchPoint;