**diff options**

author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-03-23 22:26:08 +0100 |
---|---|---|

committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-12-07 08:33:35 +0000 |

commit | 3c159957f863cf8d367a9261e7016e52cd0348c1 (patch) | |

tree | 1a56cb165b674dd49170de88b4254cd4ad0d51a4 /src/corelib | |

parent | 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>

Diffstat (limited to 'src/corelib')

0 files changed, 0 insertions, 0 deletions