Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
5.15.0
Description
If the pen is tap up from the touch screen when there are still have a finger on it , android os will send the ACTION_POINTER_UP event to main activity but not a ACTION_UP event.But the tablet event processed code does not cover this case.So that we will lost the Tablet Release Event .
// Issue occured code block
static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action, jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure) { QPointF globalPosF(x, y); QPoint globalPos((int)x, (int)y); QWindow *tlw = topLevelWindowAt(globalPos); QPointF localPos = tlw ? (globalPosF - tlw->position()) : globalPosF; // when action == ACTION_UP (1) it's a release; otherwise we say which button is pressed Qt::MouseButtons buttons = Qt::NoButton; switch (action) { case 1: // ACTION_UP case 212: // stylus release while side-button held on Galaxy Note 4 buttons = Qt::NoButton; break; default: // action is press or drag if (buttonState == 0) buttons = Qt::LeftButton; else // 2 means RightButton buttons = Qt::MouseButtons(buttonState); break; } QWindowSystemInterface::handleTabletEvent(tlw, ulong(time), localPos, globalPosF, QTabletEvent::Stylus, pointerType, buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier); }
One way to fix it
// add this line into QtNative.java at line 616.
int actionType = event.getAction(); if( actionType == 6 ) Hanlde the ACTION_POINTER_UP { actionType = 1;//Mark the ACTION_POINTER_UP as ACTION_UP } tabletEvent(id, event.getDeviceId(), event.getEventTime(), actionType , pointerType, event.getButtonState(), event.getX(), event.getY(), event.getPressure());
Attachments
Issue Links
- relates to
-
QTBUG-85386 Qt Android has the bad performance with 4K WhiteBoard
- Closed