qtbase/examples/widgets/painting
Volker Hilsheimer 7378c709f5 Examples: fix touch handling in painting examples
On macOS, we don't deliver a press event for the first press on the
track pad (Qt::WA_TouchPadAcceptSingleTouchEvents is not set by default,
so Qt doesn't deliver a single-press on the track pad as a touch event -
that makes some sense or at least maintains compatibility). Because of
that, point 0 is never added to the finger-mapping hash.

When point 0 is then released, we didn't check if we found a valid
iterator for that point ID, and the example crashed.

Fix this by checking that we have a valid iterator before dereferencing,
and by handling Stationary events in the same way as pressed (add the
point to the mapping if it's not already there).

Pick-to: 6.6 6.5
Fixes: QTBUG-110266
Change-Id: I32337b801aaabf9b821a97ddc15ad78747b5e6a2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 9d8473cdf6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 16:30:46 +00:00
..
affine Examples: remove OpenGL code paths from painting examples 2023-10-27 16:22:59 +02:00
basicdrawing Examples: Remove unnecessary Q_INIT_RESOURCE calls 2023-06-08 16:15:02 +00:00
composition Examples: remove OpenGL code paths from painting examples 2023-10-27 16:22:59 +02:00
deform Examples: remove OpenGL code paths from painting examples 2023-10-27 16:22:59 +02:00
gradients Examples: remove OpenGL code paths from painting examples 2023-10-27 16:22:59 +02:00
imagecomposition Examples: Remove unnecessary Q_INIT_RESOURCE calls 2023-06-08 16:15:02 +00:00
painterpaths
pathstroke Examples: remove OpenGL code paths from painting examples 2023-10-27 16:22:59 +02:00
shared Examples: fix touch handling in painting examples 2023-12-15 16:30:46 +00:00
transformations
CMakeLists.txt Turn the "concentriccircles" example into snippets, update screenshot 2023-12-14 19:53:02 +00:00
README
painting.pro Turn the "concentriccircles" example into snippets, update screenshot 2023-12-14 19:53:02 +00:00

README

Qt's painting system is able to render vector graphics, images, and outline
font-based text with sub-pixel accuracy accuracy using anti-aliasing to
improve rendering quality.

These examples show the most common techniques that are used when painting
with Qt, from basic concepts such as drawing simple primitives to the use of
transformations.


Documentation for these examples can be found via the Examples
link in the main Qt documentation.