From 0e5bbf3507666954fefa5e3c4a2eea531ce71259 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 14 Oct 2020 12:39:38 +0200 Subject: Make QEvent::setAccepted() virtual; set QEventPoints state the same In Qt Quick, when we deliver an item-specific QTouchEvent that contains only the subset of eventpoints that are inside the Item's bounds, traditionally the Item can accept the event to tell the delivery logic that the event is handled and doesn't need to be delivered further. But an Item cannot be expected to have total scene awareness; so now, the delivery is "done" only when all eventpoints in the original event are accepted. This behavior has been working well enough already due to logic in QQuickWindow that iterates the points and accepts them if the event is accepted; but it seems appropriate to move this enforcement into QPointerEvent itself. Making setAccepted() virtual gives us a useful degree of freedom. Event-handling code should alternatively use QEventPoint:setAccepted() or QPointerEvent::setExclusiveGrabber() to take resonsibility for only a subset of the touchpoints. Another way to put it is that we treat QPointerEvent::setAccepted() as a convenience method: accepting the QEventPoints is what counts (at least in Qt Quick). Change-Id: Icec42dc980f407bb5116f5c0852c051a4521105a Reviewed-by: Volker Hilsheimer --- src/corelib/kernel/qcoreevent.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib/kernel/qcoreevent.cpp') diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index fbea252bc0..6fdc2a94af 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -375,6 +375,10 @@ QEvent::~QEvent() For convenience, the accept flag can also be set with accept(), and cleared with ignore(). + + \note Accepting a QPointerEvent implicitly + \l {QEventPoint::setAccepted()}{accepts} all the + \l {QPointerEvent::points()}{points} that the event carries. */ /*! -- cgit v1.2.3