summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/tablet/tabletcanvas.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-04-07 15:07:04 +0200
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-04-08 19:33:28 +0000
commitf931e5e72d4617023bbea46cba2c0d61bb1efa4f (patch)
tree2715e3ea0e18245c1a7a2d4302440ac7823fb865 /examples/widgets/widgets/tablet/tabletcanvas.cpp
parente187a16906e68effcccdd7931c755e610b62e358 (diff)
add cross-platform tablet->mouse event synth; enable on Android
It's urgent to fix the issue that on Android, it became impossible to interact with any widget or MouseArea which handles only mouse events but not tablet events, using the stylus, because stylus events are sent only as QTabletEvents. Before 5.6 (change 01d78ba86a631386a4d47b7c12d2a359da28f517) they were sent as touch events, and mouse events were synthesized from those. Whereas on other platforms, every QTabletEvent is followed by a synthesized QMouseEvent. This fix proceeds in the direction that event synthesis should be done in cross-platform code so that platform plugins don't have to repeat it, following the same pattern as for touch->mouse synthesis. Just as in that case, the application can disable it, and the platform plugin can also report that it's unnecessary for Qt to do the synthesis because the platform already does. So QTBUG-51618 is fixed, but QTBUG-47007 requires us to remove the tablet->mouse synthesis from all platform plugins, because the plugin does not know whether the tablet event was accepted or not, so it does not have enough information to decide whether to synthesize a mouse event. Synthesis has been unconditional until now, which contradicts what the documentation says: the mouse event should be sent only if the tablet event is NOT accepted. We can now gradually make this promise come true. [ChangeLog][QtCore][Tablet support] A synthetic mouse event will no longer be sent after every QTabletEvent, only after those which are not accepted (as documented). Task-number: QTBUG-47007 Task-number: QTBUG-51618 Change-Id: I99404e0c2b39bbca4377be6fd48e0c6b20338466 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'examples/widgets/widgets/tablet/tabletcanvas.cpp')
-rw-r--r--examples/widgets/widgets/tablet/tabletcanvas.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp
index 5a9d8a2fd1..ba797500e9 100644
--- a/examples/widgets/widgets/tablet/tabletcanvas.cpp
+++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp
@@ -131,6 +131,7 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
default:
break;
}
+ event->accept();
update();
}
//! [3]