Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.3.1
-
None
-
Qt 5.3.1, VS2013 x64, Windows 8.1 x64, Duo Sense Pen 2 (same stylus as Surface Pro 3)
Description
When the eraser mode of the pen is used, it is not properly reported as QTabletEvent::Eraser when querying pointerType().
More precisely, it is only properly reported 20% on the time, seems random.
Workaround:
implement nativeEvent in your widget to retrieve the pen id:
bool MyWidget::nativeEvent(const QByteArray &eventType, void *message, long *result) { #if defined(Q_OS_WIN32) if(eventType=="windows_generic_MSG") { MSG* msg=(MSG*)message; switch (msg->message) { case WM_POINTERENTER: penId=GET_POINTERID_WPARAM(msg->wParam); break; } } return false; #endif }
then in tabletEvent, you can get the real pointer type this way:
void MyWidget::tabletEvent(QTabletEvent *event) { #if defined(Q_OS_WIN32) POINTER_PEN_INFO penInfo; GetPointerPenInfo(penId,&penInfo); if(penInfo.penFlags&&PEN_FLAG_INVERTED || penInfo.penFlags&&PEN_FLAG_ERASER) { //eraser } #endif }
Attachments
Issue Links
- relates to
-
QTBUG-40019 Windows: QApplication never detect TabletLeaveProximity event
- Closed