summaryrefslogtreecommitdiffstats log msg author committer range
diff options
 context: 12345678910152025303540 space: includeignore mode: unifiedssdiffstat only
author committer Shawn Rutledge 2016-03-23 22:26:08 +0100 Shawn Rutledge 2016-12-07 08:33:35 +0000 3c159957f863cf8d367a9261e7016e52cd0348c1 (patch) 1a56cb165b674dd49170de88b4254cd4ad0d51a4 f7253b25684eabf68973cc4486b32f0dc346b70c (diff)
TouchPoint: add horizontalDiameter, verticalDiameter; deprecate rects
The contact patch of a finger on a touchscreen tends to be roughly elliptical. If we model it as a QRectF, it's not clear whether the ellipse should be considered to be inscribed in the rectangle and then rotated, or whether the rectangle represents the outer bounds of the rotated ellipse. In practice, since most touchscreens can't measure rotation, it is effectively the latter. But modeling it that way means information is lost if the touchscreen can measure rotation: you can determine the bounds of a rotated ellipse, but you cannot derive the rotated ellipse from its bounds. So it's better to model the axes of the ellipse explicitly. This has the added benefit of saving a little storage space: we replace 3 QRectF instances, whose width and height will normally be the same, with 3 positions (bringing the total to 12 QPointF's) and one set of axes. Further, most applications only care about the center of each contact patch, so it's better to store that explicitly instead of calculating QRectF::center() repeatedly. In the past there may have been an assumption that the width of the rect is the same as the horizontalDiameter of the ellipse, so the rect could be considered to be rotated, and the ellipse to be inscribed. But in d0b1c646b4a351f7eea2137c68993ae63b2b6bab and 40e4949674eaf7ceb09f6d18479ead1a36b384fd the point was made that the rect is actually the bounding box of the rotated ellipse. [ChangeLog][QtGui][QTouchEvent] TouchPoint::rect(), sceneRect() and screenRect() are deprecated; a touchpoint is now modeled as an ellipse, so please use pos(), scenePos(), screenPos(), horizontalDiameter() and verticalDiameter() instead. Change-Id: Ic06f6165e2d90fc9d4cc19cf4938d4faf5766bb4 Reviewed-by: Jan Arve SÃ¦ther <jan-arve.saether@qt.io>
-rw-r--r--doc/src/images/touchpoint-metrics.pngbin0 -> 46111 bytes
-rw-r--r--src/gui/kernel/qevent.cpp106
-rw-r--r--src/gui/kernel/qevent.h11
-rw-r--r--src/gui/kernel/qevent_p.h9
-rw-r--r--src/gui/kernel/qguiapplication.cpp9
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h6
-rw-r--r--src/widgets/kernel/qapplication.cpp8
7 files changed, 119 insertions, 30 deletions