Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQuickDeliveryAgentPrivate Class Reference

#include <qquickdeliveryagent_p_p.h>

Inheritance diagram for QQuickDeliveryAgentPrivate:
Collaboration diagram for QQuickDeliveryAgentPrivate:

Public Types

enum  FocusOption { DontChangeFocusProperty = 0x01 , DontChangeSubFocusItem = 0x02 }
enum class  HoverChange : uint8_t { Clear , Set }
Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>

Public Member Functions

 QQuickDeliveryAgentPrivate (QQuickItem *root)
 ~QQuickDeliveryAgentPrivate ()
void deliverKeyEvent (QKeyEvent *e)
void setFocusInScope (QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions={ })
 Set the focus inside scope to be item.
void clearFocusInScope (QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions={ })
void clearFocusObject ()
void updateFocusItemTransform ()
QQuickItemfocusTargetItem () const
 Returns the item that should get active focus when the root focus scope gets active focus.
bool isDeliveringTouchAsMouse () const
void cancelTouchMouseSynthesis ()
bool checkIfDoubleTapped (ulong newPressEventTimestamp, const QPoint &newPressPos)
void resetIfDoubleTapPrevented (const QEventPoint &pressedPoint)
QPointingDevicePrivate::EventPointDatamousePointData ()
QPointerEventeventInDelivery () const
bool deliverTouchAsMouse (QQuickItem *item, QTouchEvent *pointerEvent)
void translateTouchEvent (QTouchEvent *touchEvent)
void removeGrabber (QQuickItem *grabber, bool mouse=true, bool touch=true, bool cancel=false)
 Ungrabs all touchpoint grabs and/or the mouse grab from the given item grabber.
void clearGrabbers (QPointerEvent *pointerEvent)
void onGrabChanged (QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point)
void deliverToPassiveGrabbers (const QVector< QPointer< QObject > > &passiveGrabbers, QPointerEvent *pointerEvent)
bool sendFilteredMouseEvent (QEvent *event, QQuickItem *receiver, QQuickItem *filteringParent)
bool sendFilteredPointerEvent (QPointerEvent *event, QQuickItem *receiver, QQuickItem *filteringParent=nullptr)
bool sendFilteredPointerEventImpl (QPointerEvent *event, QQuickItem *receiver, QQuickItem *filteringParent)
bool deliverSinglePointEventUntilAccepted (QPointerEvent *)
void handleTouchEvent (QTouchEvent *)
void handleMouseEvent (QMouseEvent *)
 Handle event on behalf of this delivery agent's window or subscene.
bool compressTouchEvent (QTouchEvent *)
void flushFrameSynchronousEvents (QQuickWindow *win)
void deliverDelayedTouchEvent ()
void handleWindowDeactivate (QQuickWindow *win)
void handleWindowHidden (QQuickWindow *win)
bool allUpdatedPointsAccepted (const QPointerEvent *ev)
QList< QObject * > exclusiveGrabbers (QPointerEvent *ev)
void touchToMouseEvent (QEvent::Type type, const QEventPoint &p, const QTouchEvent *touchEvent, QMutableSinglePointEvent *mouseEvent)
void ensureDeviceConnected (const QPointingDevice *dev)
void deliverPointerEvent (QPointerEvent *)
bool deliverTouchCancelEvent (QTouchEvent *)
bool deliverPressOrReleaseEvent (QPointerEvent *, bool handlersOnly=false)
void deliverUpdatedPoints (QPointerEvent *event)
void deliverMatchingPointsToItem (QQuickItem *item, bool isGrabber, QPointerEvent *pointerEvent, bool handlersOnly=false)
QVector< QQuickItem * > eventTargets (QQuickItem *, const QEvent *event, QPointF scenePos, qxp::function_ref< std::optional< bool >(QQuickItem *, const QEvent *)> predicate) const
QVector< QQuickItem * > pointerTargets (QQuickItem *, const QPointerEvent *event, const QEventPoint &point, bool checkMouseButtons, bool checkAcceptsTouch) const
QVector< QQuickItem * > mergePointerTargets (const QVector< QQuickItem * > &list1, const QVector< QQuickItem * > &list2) const
bool deliverHoverEvent (const QPointF &scenePos, const QPointF &lastScenePos, Qt::KeyboardModifiers modifiers, ulong timestamp)
bool deliverHoverEventRecursive (QQuickItem *, const QPointF &scenePos, const QPointF &lastScenePos, Qt::KeyboardModifiers modifiers, ulong timestamp)
bool deliverHoverEventToItem (QQuickItem *item, const QPointF &scenePos, const QPointF &lastScenePos, Qt::KeyboardModifiers modifiers, ulong timestamp, HoverChange hoverChange)
bool sendHoverEvent (QEvent::Type, QQuickItem *, const QPointF &scenePos, const QPointF &lastScenePos, Qt::KeyboardModifiers modifiers, ulong timestamp)
bool clearHover (ulong timestamp=0)
QVector< QQuickItem * > contextMenuTargets (QQuickItem *item, const QContextMenuEvent *event) const
void deliverContextMenuEvent (QContextMenuEvent *event)
Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
void setObjectNameWithoutBindings (const QString &name)
 QObjectPrivate (decltype(QObjectPrivateVersion) version=QObjectPrivateVersion)
virtual ~QObjectPrivate ()
void deleteChildren ()
void clearBindingStorage ()
void setParent_helper (QObject *)
void moveToThread_helper ()
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
QObjectList receiverList (const char *signal) const
void ensureConnectionData ()
void addConnection (int signal, Connection *c)
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
bool maybeSignalConnected (uint signalIndex) const
bool isDeclarativeSignalConnected (uint signalIdx) const
void connectNotify (const QMetaMethod &signal)
void disconnectNotify (const QMetaMethod &signal)
void reinitBindingStorageAfterThreadMove ()
virtual std::string flagsForDumping () const
virtual void writeToDebugStream (QDebug &) const
QtPrivate::QPropertyAdaptorSlotObjectgetPropertyAdaptorSlotObject (const QMetaProperty &property)
Public Member Functions inherited from QObjectData
 QObjectData ()=default
virtual ~QObjectData ()=0
const QMetaObjectdynamicMetaObject () const

Static Public Member Functions

static void notifyFocusChangesRecur (QQuickItem **item, int remaining, Qt::FocusReason reason)
static QQuickDeliveryAgentcurrentOrItemDeliveryAgent (const QQuickItem *item)
static QPointerEventclonePointerEvent (QPointerEvent *event, std::optional< QPointF > transformedLocalPos=std::nullopt)
static void localizePointerEvent (QPointerEvent *ev, const QQuickItem *dest)
static bool anyPointGrabbed (const QPointerEvent *ev)
static bool allPointsGrabbed (const QPointerEvent *ev)
static bool isMouseEvent (const QPointerEvent *ev)
static bool isMouseOrWheelEvent (const QPointerEvent *ev)
static bool isHoverEvent (const QPointerEvent *ev)
static bool isHoveringMoveEvent (const QPointerEvent *ev)
static bool isTouchEvent (const QPointerEvent *ev)
static bool isTabletEvent (const QPointerEvent *ev)
static bool isEventFromMouseOrTouchpad (const QPointerEvent *ev)
static bool isSynthMouse (const QPointerEvent *ev)
static bool isWithinDoubleClickInterval (ulong timeInterval)
 Returns false if the time constraint for detecting a double-click is violated.
static bool isWithinDoubleTapDistance (const QPoint &distanceBetweenPresses)
 Returns false if the spatial constraint for detecting a touchscreen double-tap is violated.
static bool isSinglePointDevice (const QInputDevice *dev)
 Returns true if dev is a type of device that only sends QSinglePointEvents.
static QQuickPointingDeviceExtradeviceExtra (const QInputDevice *device)
static bool dragOverThreshold (qreal d, Qt::Axis axis, QMouseEvent *event, int startDragThreshold=-1)
static bool dragOverThreshold (qreal d, Qt::Axis axis, const QEventPoint &tp, int startDragThreshold=-1)
static bool dragOverThreshold (QVector2D delta)
Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *c)
static QObjectPrivateget (QObject *o)
static const QObjectPrivateget (const QObject *o)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
template<typename Func1, typename Func2>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
static QMetaObject::Connection connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
static bool disconnect (const QObject *sender, int signal_index, void **slot)
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot)

Public Attributes

QQuickItemrootItem = nullptr
QQuickItemactiveFocusItem = nullptr
QQuickItemlastUngrabbed = nullptr
QStack< QPointerEvent * > eventsInDelivery
QFlatMap< QPointer< QQuickItem >, uinthoverItems
QVector< QQuickItem * > hasFiltered
QVector< QQuickItem * > skipDelivery
std::unique_ptr< QMutableTouchEventdelayedTouch
QList< const QPointingDevice * > knownPointingDevices
uint currentHoverId = 0
uchar compressedTouchCount = 0
bool allowChildEventFiltering = true
bool frameSynchronousHoverEnabled = true
bool hoveredLeafItemFound = false
bool isSubsceneAgent = false
Qt::FocusReason lastFocusReason = Qt::OtherFocusReason
int pointerEventRecursionGuard = 0
int touchMouseId = -1
const QPointingDevicetouchMouseDevice = nullptr
ulong touchMousePressTimestamp = 0
QPoint touchMousePressPos
QQuickDeliveryAgent::TransformsceneTransform = nullptr
QPointF lastMousePosition
Public Attributes inherited from QObjectPrivate
ExtraDataextraData
QAtomicPointer< QThreadDatathreadData
QAtomicPointer< ConnectionDataconnections
union { 
   QObject *   currentChildBeingDeleted 
   QAbstractDeclarativeData *   declarativeData 
}; 
QAtomicPointer< QtSharedPointer::ExternalRefCountDatasharedRefcount
Public Attributes inherited from QObjectData
QObjectq_ptr
QObjectparent
QObjectList children
uint isWidget: 1
uint blockSig: 1
uint wasDeleted: 1
uint isDeletingChildren: 1
uint sendChildEvents: 1
uint receiveChildEvents: 1
uint isWindow: 1
uint deleteLaterCalled: 1
uint isQuickItem: 1
uint willBeWidget: 1
uint wasWidget: 1
uint receiveParentEvents: 1
uint unused: 20
QAtomicInt postedEvents
QDynamicMetaObjectDatametaObject
QBindingStorage bindingStorage

Static Public Attributes

static bool subsceneAgentsExist
static QQuickDeliveryAgentcurrentEventDeliveryAgent

Detailed Description

Definition at line 47 of file qquickdeliveryagent_p_p.h.

Member Enumeration Documentation

◆ FocusOption

Enumerator
DontChangeFocusProperty 
DontChangeSubFocusItem 

Definition at line 60 of file qquickdeliveryagent_p_p.h.

◆ HoverChange

enum class QQuickDeliveryAgentPrivate::HoverChange : uint8_t
strong
Enumerator
Clear 
Set 

Definition at line 178 of file qquickdeliveryagent_p_p.h.

Constructor & Destructor Documentation

◆ QQuickDeliveryAgentPrivate()

QQuickDeliveryAgentPrivate::QQuickDeliveryAgentPrivate ( QQuickItem * root)

Definition at line 984 of file qquickdeliveryagent.cpp.

◆ ~QQuickDeliveryAgentPrivate()

QQuickDeliveryAgentPrivate::~QQuickDeliveryAgentPrivate ( )

Definition at line 997 of file qquickdeliveryagent.cpp.

Member Function Documentation

◆ allPointsGrabbed()

bool QQuickDeliveryAgentPrivate::allPointsGrabbed ( const QPointerEvent * ev)
static

Definition at line 1507 of file qquickdeliveryagent.cpp.

◆ allUpdatedPointsAccepted()

bool QQuickDeliveryAgentPrivate::allUpdatedPointsAccepted ( const QPointerEvent * ev)

Definition at line 1461 of file qquickdeliveryagent.cpp.

◆ anyPointGrabbed()

bool QQuickDeliveryAgentPrivate::anyPointGrabbed ( const QPointerEvent * ev)
static

Definition at line 1498 of file qquickdeliveryagent.cpp.

◆ cancelTouchMouseSynthesis()

void QQuickDeliveryAgentPrivate::cancelTouchMouseSynthesis ( )

Definition at line 145 of file qquickdeliveryagent.cpp.

◆ checkIfDoubleTapped()

bool QQuickDeliveryAgentPrivate::checkIfDoubleTapped ( ulong newPressEventTimestamp,
const QPoint & newPressPos )

Definition at line 93 of file qquickdeliveryagent.cpp.

◆ clearFocusInScope()

void QQuickDeliveryAgentPrivate::clearFocusInScope ( QQuickItem * scope,
QQuickItem * item,
Qt::FocusReason reason,
FocusOptions options = { } )

Definition at line 537 of file qquickdeliveryagent.cpp.

◆ clearFocusObject()

void QQuickDeliveryAgentPrivate::clearFocusObject ( )

Definition at line 638 of file qquickdeliveryagent.cpp.

◆ clearGrabbers()

void QQuickDeliveryAgentPrivate::clearGrabbers ( QPointerEvent * pointerEvent)

Clears all exclusive and passive grabs for the points in pointerEvent.

We never allow any kind of grab to persist after release, unless we're waiting for a synth event from QtGui (as with most tablet events), so for points that are fully released, the grab is cleared.

Called when QQuickWindow::event dispatches events, or when the QQuickOverlay has filtered an event so that it bypasses normal delivery.

Definition at line 324 of file qquickdeliveryagent.cpp.

◆ clearHover()

bool QQuickDeliveryAgentPrivate::clearHover ( ulong timestamp = 0)

Definition at line 671 of file qquickdeliveryagent.cpp.

◆ clonePointerEvent()

QPointerEvent * QQuickDeliveryAgentPrivate::clonePointerEvent ( QPointerEvent * event,
std::optional< QPointF > transformedLocalPos = std::nullopt )
static

Make a copy of any type of QPointerEvent, and optionally localize it by setting its first point's local position() if transformedLocalPos is given.

Note
some subclasses of QSinglePointEvent, such as QWheelEvent, add extra storage. This function doesn't yet support cloning all of those; it can be extended if needed.

Definition at line 1013 of file qquickdeliveryagent.cpp.

◆ compressTouchEvent()

bool QQuickDeliveryAgentPrivate::compressTouchEvent ( QTouchEvent * event)

This function is called from handleTouchEvent() in case a series of touch events containing only Updated and Stationary points arrives within a short period of time. (Some touchscreens are more "jittery" than others.)

It would be a waste of CPU time to deliver events and have items in the scene getting modified more often than once per frame; so here we try to coalesce the series of updates into a single event containing all updates that occur within one frame period, and deliverDelayedTouchEvent() is called from flushFrameSynchronousEvents() to send that single event. This is the reason why touch compression lives here so far, instead of in a lower layer: the render loop updates the scene in sync with the screen's vsync, and flushFrameSynchronousEvents() is called from there (for example from QSGThreadedRenderLoop::polishAndSync(), and equivalent places in other render loops). It would be preferable to move this code down to a lower level eventually, though, because it's not fundamentally a Qt Quick concern.

This optimization can be turned off by setting the environment variable QML_NO_TOUCH_COMPRESSION.

Returns true if "done", false if the caller needs to finish the event delivery.

Definition at line 1650 of file qquickdeliveryagent.cpp.

◆ contextMenuTargets()

QVector< QQuickItem * > QQuickDeliveryAgentPrivate::contextMenuTargets ( QQuickItem * item,
const QContextMenuEvent * event ) const

Returns all items that could potentially want event.

(Similar to \l pointerTargets(), necessary because QContextMenuEvent is not a QPointerEvent.)

Definition at line 2979 of file qquickdeliveryagent.cpp.

◆ currentOrItemDeliveryAgent()

QQuickDeliveryAgent * QQuickDeliveryAgentPrivate::currentOrItemDeliveryAgent ( const QQuickItem * item)
static

If called during event delivery, returns the agent that is delivering the event, without checking whether item is reachable from there. Otherwise returns QQuickItemPrivate::deliveryAgent() (the delivery agent for the narrowest subscene containing item), or null if item is null.

Definition at line 741 of file qquickdeliveryagent.cpp.

◆ deliverContextMenuEvent()

void QQuickDeliveryAgentPrivate::deliverContextMenuEvent ( QContextMenuEvent * event)

Based on \l deliverPointerEvent().

Definition at line 2996 of file qquickdeliveryagent.cpp.

◆ deliverDelayedTouchEvent()

void QQuickDeliveryAgentPrivate::deliverDelayedTouchEvent ( )

Definition at line 1402 of file qquickdeliveryagent.cpp.

◆ deliverHoverEvent()

bool QQuickDeliveryAgentPrivate::deliverHoverEvent ( const QPointF & scenePos,
const QPointF & lastScenePos,
Qt::KeyboardModifiers modifiers,
ulong timestamp )

Delivers a hover event at scenePos to the whole scene or subscene that this DeliveryAgent is responsible for. Returns true if delivery is "done".

Definition at line 1107 of file qquickdeliveryagent.cpp.

◆ deliverHoverEventRecursive()

bool QQuickDeliveryAgentPrivate::deliverHoverEventRecursive ( QQuickItem * item,
const QPointF & scenePos,
const QPointF & lastScenePos,
Qt::KeyboardModifiers modifiers,
ulong timestamp )

Delivers a hover event at scenePos to item and all its children. The children get it first. As soon as any item allows the event to remain accepted, recursion stops. Returns true in that case, or false if the event is rejected.

Each item that has hover enabled (from setAcceptHoverEvents()) has the QQuickItemPrivate::hoverEnabled flag set. This only controls whether we should send hover events to the item itself. (HoverHandlers no longer set this flag.) When an item has hoverEnabled set, all its ancestors have the QQuickItemPrivate::subtreeHoverEnabled set. This function will follow the subtrees that have subtreeHoverEnabled by recursing into each child with that flag set. And for each child (in addition to the item itself) that also has hoverEnabled set, we call deliverHoverEventToItem() to actually deliver the event to it. The item can then choose to accept or reject the event. This is only for control over whether we stop propagation or not: an item can reject the event, but at the same time be hovered (and therefore in hoverItems). By accepting the event, the item will effectivly end up as the only one hovered. Any other HoverHandler that may be a child of an item that is stacked underneath, will not. Note that since siblings can overlap, there can be more than one leaf item under the mouse.

Note that HoverHandler doesn't set the hoverEnabled flag on the parent item. But still, adding a HoverHandler to an item will set its subtreeHoverEnabled flag. So all the propagation logic described above will otherwise be the same. But the hoverEnabled flag can be used to resolve if subtreeHoverEnabled is on because the application explicitly requested it (setAcceptHoverEvents()), or indirectly, because the item has HoverHandlers.

For legacy reasons (Qt 6.1), as soon as we find a leaf item that has hover enabled, and therefore receives the event, we stop recursing into the remaining siblings (even if the event was ignored). This means that we only allow hover events to propagate up the direct parent-child hierarchy, and not to siblings. However, if the first candidate HoverHandler is disabled, delivery continues to the next one, which may be a sibling (QTBUG-106548).

Definition at line 1197 of file qquickdeliveryagent.cpp.

◆ deliverHoverEventToItem()

bool QQuickDeliveryAgentPrivate::deliverHoverEventToItem ( QQuickItem * item,
const QPointF & scenePos,
const QPointF & lastScenePos,
Qt::KeyboardModifiers modifiers,
ulong timestamp,
HoverChange hoverChange )

Delivers a hover event at scenePos to item and its HoverHandlers if any. Returns true if the event remains accepted, false if rejected.

If clearHover is true, it will be sent as a QEvent::HoverLeave event, and the item and its handlers are expected to transition into their non-hovered states even if the position still indicates that the mouse is inside.

Definition at line 1250 of file qquickdeliveryagent.cpp.

◆ deliverKeyEvent()

void QQuickDeliveryAgentPrivate::deliverKeyEvent ( QKeyEvent * e)

Definition at line 952 of file qquickdeliveryagent.cpp.

◆ deliverMatchingPointsToItem()

void QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem ( QQuickItem * item,
bool isGrabber,
QPointerEvent * pointerEvent,
bool handlersOnly = false )

Deliver pointerEvent to item and its handlers, if any. If handlersOnly is true, skip QQuickItem::event() and just visit its handlers via QQuickItemPrivate::handlePointerEvent().

This function exists just to de-duplicate the common code between deliverPressOrReleaseEvent() and deliverUpdatedPoints().

Definition at line 2444 of file qquickdeliveryagent.cpp.

◆ deliverPointerEvent()

void QQuickDeliveryAgentPrivate::deliverPointerEvent ( QPointerEvent * event)

The entry point for delivery of event after determining that it is a pointer event, and either does not need to be coalesced in compressTouchEvent(), or already has been.

When it returns, event delivery is done.

Definition at line 2009 of file qquickdeliveryagent.cpp.

◆ deliverPressOrReleaseEvent()

bool QQuickDeliveryAgentPrivate::deliverPressOrReleaseEvent ( QPointerEvent * event,
bool handlersOnly = false )

Deliver a pointer event containing newly pressed or released QEventPoints. If handlersOnly is true, skip the items and just deliver to Pointer Handlers (via QQuickItemPrivate::handlePointerEvent()).

For the sake of determinism, this function first builds the list targetItems by calling pointerTargets() on the root item. That is, the list of items to "visit" is determined at the beginning, and will not be affected if items reparent, hide, or otherwise try to make themselves eligible or ineligible during delivery. (Avoid bugs due to ugly just-in-time tricks in JS event handlers, filters etc.)

Whenever a touch gesture is in progress, and another touchpoint is pressed, or an existing touchpoint is released, we "start over" with delivery: that's why this function is called whenever the event contains newly pressed or released points. It's not necessary for a handler or an item to greedily grab all touchpoints just in case a valid gesture might start. QQuickMultiPointHandler::wantsPointerEvent() can calmly return false if the number of points is less than QQuickMultiPointHandler::minimumPointCount(), because it knows it will be asked again if the number of points increases.

When handlersOnly is false, event visits the items in targetItems via QQuickItem::event(). We have to call sendFilteredPointerEvent() before visiting each item, just in case a Flickable (or some other parent-filter) will decide to intercept the event. But we also have to be very careful never to let the same Flickable filter the same event twice, because when Flickable decides to intercept, it lets the child item have that event, and then grabs the next event. That allows you to drag a Slider, DragHandler or whatever inside a ListView delegate: if you're dragging in the correct direction for the draggable child, it can use QQuickItem::setKeepMouseGrab(), QQuickItem::setKeepTouchGrab() or QQuickPointerHandler::grabPermissions() to prevent Flickable from intercepting during filtering, only if it actually has the exclusive grab already when Flickable attempts to take it. Typically, both the Flickable and the child are checking the same drag threshold, so the child must have a chance to grab and keep the grab before Flickable gets a chance to steal it, even though Flickable actually sees the event first during filtering.

Definition at line 2363 of file qquickdeliveryagent.cpp.

◆ deliverSinglePointEventUntilAccepted()

bool QQuickDeliveryAgentPrivate::deliverSinglePointEventUntilAccepted ( QPointerEvent * event)

Definition at line 1346 of file qquickdeliveryagent.cpp.

◆ deliverToPassiveGrabbers()

void QQuickDeliveryAgentPrivate::deliverToPassiveGrabbers ( const QVector< QPointer< QObject > > & passiveGrabbers,
QPointerEvent * pointerEvent )

Definition at line 1025 of file qquickdeliveryagent.cpp.

◆ deliverTouchAsMouse()

bool QQuickDeliveryAgentPrivate::deliverTouchAsMouse ( QQuickItem * item,
QTouchEvent * pointerEvent )

Definition at line 152 of file qquickdeliveryagent.cpp.

◆ deliverTouchCancelEvent()

bool QQuickDeliveryAgentPrivate::deliverTouchCancelEvent ( QTouchEvent * event)

Definition at line 1387 of file qquickdeliveryagent.cpp.

◆ deliverUpdatedPoints()

void QQuickDeliveryAgentPrivate::deliverUpdatedPoints ( QPointerEvent * event)

Deliver updated points to existing grabbers.

Definition at line 2234 of file qquickdeliveryagent.cpp.

◆ deviceExtra()

QQuickPointingDeviceExtra * QQuickDeliveryAgentPrivate::deviceExtra ( const QInputDevice * device)
static

Definition at line 1612 of file qquickdeliveryagent.cpp.

◆ dragOverThreshold() [1/3]

bool QQuickDeliveryAgentPrivate::dragOverThreshold ( qreal d,
Qt::Axis axis,
const QEventPoint & tp,
int startDragThreshold = -1 )
static

Returns true if the movement delta d in pixels along the axis exceeds startDragThreshold if it is set, or QStyleHints::startDragDistance(); or, if QEventPoint::velocity() of tp exceeds QStyleHints::startDragVelocity().

See also
QQuickPointerHandlerPrivate::dragOverThreshold()

Definition at line 2949 of file qquickdeliveryagent.cpp.

◆ dragOverThreshold() [2/3]

bool QQuickDeliveryAgentPrivate::dragOverThreshold ( qreal d,
Qt::Axis axis,
QMouseEvent * event,
int startDragThreshold = -1 )
static

Returns true if the movement delta d in pixels along the axis exceeds startDragThreshold if it is set, or QStyleHints::startDragDistance(); or, if QEventPoint::velocity() of event exceeds QStyleHints::startDragVelocity().

See also
QQuickPointerHandlerPrivate::dragOverThreshold()

Definition at line 2928 of file qquickdeliveryagent.cpp.

◆ dragOverThreshold() [3/3]

bool QQuickDeliveryAgentPrivate::dragOverThreshold ( QVector2D delta)
static

Returns true if the movement delta in pixels exceeds QStyleHints::startDragDistance().

See also
QQuickDeliveryAgentPrivate::dragOverThreshold()

Definition at line 2966 of file qquickdeliveryagent.cpp.

◆ ensureDeviceConnected()

void QQuickDeliveryAgentPrivate::ensureDeviceConnected ( const QPointingDevice * dev)

Called when a QPointingDevice is detected, to ensure that the QPointingDevice::grabChanged() signal is connected to QQuickDeliveryAgentPrivate::onGrabChanged().

knownPointingDevices is maintained only to track signal connections, and should not be used for other purposes. The usual place to get a list of all devices is QInputDevice::devices().

Definition at line 1992 of file qquickdeliveryagent.cpp.

◆ eventInDelivery()

QPointerEvent * QQuickDeliveryAgentPrivate::eventInDelivery ( ) const
Deprecated
events are handled by methods in which the event is an argument

Accessor for use by legacy methods such as QQuickItem::grabMouse(), QQuickItem::ungrabMouse(), and QQuickItem::grabTouchPoints() which are not given sufficient context to do the grabbing. We should remove eventsInDelivery in Qt 7.

Deprecated
events are handled by methods in which the event is an argument

Accessor for use by legacy methods such as QQuickItem::grabMouse(), QQuickItem::ungrabMouse(), and QQuickItem::grabTouchPoints() which are not given sufficient context to do the grabbing. We should remove eventsInDelivery in Qt 7.

Definition at line 125 of file qquickdeliveryagent.cpp.

◆ eventTargets()

QVector< QQuickItem * > QQuickDeliveryAgentPrivate::eventTargets ( QQuickItem * item,
const QEvent * event,
QPointF scenePos,
qxp::function_ref< std::optional< bool >(QQuickItem *, const QEvent *)> predicate ) const

Returns a list of all items that are spatially relevant to receive event occurring at scenePos, starting with item and recursively checking all the children. \list

  • If QQuickItem::clip() is true and scenePos is outside of QQuickItem::clipRect(), its children are also omitted. (We stop the recursion, because any clipped-off portions of children under scenePos are invisible.)
  • Ignore any item in a subscene that "belongs to" a different DeliveryAgent. (In current practice, this only happens in 2D scenes in Qt Quick 3D.)
  • Ignore any item for which the given predicate returns false; include any item for which the predicate returns true. \endlist

Definition at line 2118 of file qquickdeliveryagent.cpp.

◆ exclusiveGrabbers()

QList< QObject * > QQuickDeliveryAgentPrivate::exclusiveGrabbers ( QPointerEvent * ev)

Definition at line 1486 of file qquickdeliveryagent.cpp.

◆ flushFrameSynchronousEvents()

void QQuickDeliveryAgentPrivate::flushFrameSynchronousEvents ( QQuickWindow * win)

Flush events before a frame is rendered in win.

This is here because of compressTouchEvent(): we need to ensure that coalesced touch events are actually delivered in time to cause the desired reactions of items and their handlers. And then since it was introduced because of that, we started using this function for once-per-frame hover events too, to take care of changing hover state when an item animates under the mouse cursor at a time that the mouse cursor is not moving.

This is done before QQuickItem::updatePolish() is called on all the items that requested polishing.

See also
qq-hover-event-delivery

Definition at line 1836 of file qquickdeliveryagent.cpp.

◆ focusTargetItem()

QQuickItem * QQuickDeliveryAgentPrivate::focusTargetItem ( ) const

Returns the item that should get active focus when the root focus scope gets active focus.

Definition at line 718 of file qquickdeliveryagent.cpp.

◆ handleMouseEvent()

void QQuickDeliveryAgentPrivate::handleMouseEvent ( QMouseEvent * event)

Handle event on behalf of this delivery agent's window or subscene.

Definition at line 1765 of file qquickdeliveryagent.cpp.

◆ handleTouchEvent()

void QQuickDeliveryAgentPrivate::handleTouchEvent ( QTouchEvent * event)

Definition at line 1730 of file qquickdeliveryagent.cpp.

◆ handleWindowDeactivate()

void QQuickDeliveryAgentPrivate::handleWindowDeactivate ( QQuickWindow * win)

The handler for the QEvent::WindowDeactivate event, and also when Qt::ApplicationState tells us the application is no longer active. It clears all exclusive grabs of items and handlers whose window is this one, for all known pointing devices.

The QEvent is not passed into this function because in the first case it's just a plain QEvent with no extra data, and because the application state change is delivered via a signal rather than an event.

Definition at line 1423 of file qquickdeliveryagent.cpp.

◆ handleWindowHidden()

void QQuickDeliveryAgentPrivate::handleWindowHidden ( QQuickWindow * win)

Definition at line 1454 of file qquickdeliveryagent.cpp.

◆ isDeliveringTouchAsMouse()

bool QQuickDeliveryAgentPrivate::isDeliveringTouchAsMouse ( ) const
inline

Definition at line 113 of file qquickdeliveryagent_p_p.h.

◆ isEventFromMouseOrTouchpad()

bool QQuickDeliveryAgentPrivate::isEventFromMouseOrTouchpad ( const QPointerEvent * ev)
static

Definition at line 1578 of file qquickdeliveryagent.cpp.

◆ isHoverEvent()

bool QQuickDeliveryAgentPrivate::isHoverEvent ( const QPointerEvent * ev)
static

Definition at line 1534 of file qquickdeliveryagent.cpp.

◆ isHoveringMoveEvent()

bool QQuickDeliveryAgentPrivate::isHoveringMoveEvent ( const QPointerEvent * ev)
static

◆ isMouseEvent()

bool QQuickDeliveryAgentPrivate::isMouseEvent ( const QPointerEvent * ev)
static

Definition at line 1516 of file qquickdeliveryagent.cpp.

◆ isMouseOrWheelEvent()

bool QQuickDeliveryAgentPrivate::isMouseOrWheelEvent ( const QPointerEvent * ev)
static

Definition at line 1529 of file qquickdeliveryagent.cpp.

◆ isSinglePointDevice()

bool QQuickDeliveryAgentPrivate::isSinglePointDevice ( const QInputDevice * dev)
static

Returns true if dev is a type of device that only sends QSinglePointEvents.

Definition at line 1594 of file qquickdeliveryagent.cpp.

◆ isSynthMouse()

bool QQuickDeliveryAgentPrivate::isSynthMouse ( const QPointerEvent * ev)
static

Definition at line 1585 of file qquickdeliveryagent.cpp.

◆ isTabletEvent()

bool QQuickDeliveryAgentPrivate::isTabletEvent ( const QPointerEvent * ev)
static

Definition at line 1559 of file qquickdeliveryagent.cpp.

◆ isTouchEvent()

bool QQuickDeliveryAgentPrivate::isTouchEvent ( const QPointerEvent * ev)
static

Definition at line 1546 of file qquickdeliveryagent.cpp.

◆ isWithinDoubleClickInterval()

bool QQuickDeliveryAgentPrivate::isWithinDoubleClickInterval ( ulong timeInterval)
static

Returns false if the time constraint for detecting a double-click is violated.

Definition at line 78 of file qquickdeliveryagent.cpp.

◆ isWithinDoubleTapDistance()

bool QQuickDeliveryAgentPrivate::isWithinDoubleTapDistance ( const QPoint & distanceBetweenPresses)
static

Returns false if the spatial constraint for detecting a touchscreen double-tap is violated.

Definition at line 86 of file qquickdeliveryagent.cpp.

◆ localizePointerEvent()

void QQuickDeliveryAgentPrivate::localizePointerEvent ( QPointerEvent * ev,
const QQuickItem * dest )
static

Localize ev for delivery to dest.

Unlike QMutableTouchEvent::localized(), this modifies the QEventPoint instances in ev, which is more efficient than making a copy.

Definition at line 1476 of file qquickdeliveryagent.cpp.

◆ mergePointerTargets()

QVector< QQuickItem * > QQuickDeliveryAgentPrivate::mergePointerTargets ( const QVector< QQuickItem * > & list1,
const QVector< QQuickItem * > & list2 ) const

Returns a joined list consisting of the items in list1 and list2. list1 has priority; common items come last.

Definition at line 2211 of file qquickdeliveryagent.cpp.

◆ mousePointData()

QPointingDevicePrivate::EventPointData * QQuickDeliveryAgentPrivate::mousePointData ( )

A helper function for the benefit of obsolete APIs like QQuickItem::grabMouse() that don't have the currently-being-delivered event in context. Returns the device the currently-being-delivered event comse from.

Definition at line 137 of file qquickdeliveryagent.cpp.

◆ notifyFocusChangesRecur()

void QQuickDeliveryAgentPrivate::notifyFocusChangesRecur ( QQuickItem ** item,
int remaining,
Qt::FocusReason reason )
static

Definition at line 646 of file qquickdeliveryagent.cpp.

◆ onGrabChanged()

void QQuickDeliveryAgentPrivate::onGrabChanged ( QObject * grabber,
QPointingDevice::GrabTransition transition,
const QPointerEvent * event,
const QEventPoint & point )

React to the fact that grabber underwent a grab transition while an item or handler was handling point from event. I.e. handle the QPointingDevice::grabChanged() signal.

This notifies the relevant items and/or pointer handlers, and does cleanup when grabs are lost or relinquished.

Definition at line 1890 of file qquickdeliveryagent.cpp.

◆ pointerTargets()

QVector< QQuickItem * > QQuickDeliveryAgentPrivate::pointerTargets ( QQuickItem * item,
const QPointerEvent * event,
const QEventPoint & point,
bool checkMouseButtons,
bool checkAcceptsTouch ) const

Returns a list of all items that are spatially relevant to receive event occurring at point, starting with item and recursively checking all the children. \list

  • If an item has pointer handlers, call QQuickPointerHandler::wantsEventPoint() on every handler to decide whether the item is eligible.
  • Otherwise, if checkMouseButtons is true, it means we are finding targets for a mouse event, so no item for which acceptedMouseButtons() is NoButton will be added.
  • Otherwise, if checkAcceptsTouch is true, it means we are finding targets for a touch event, so either acceptTouchEvents() must return true or it must accept a synthesized mouse event. I.e. if acceptTouchEvents() returns false, it gets added only if acceptedMouseButtons() is true.
  • If QQuickItem::clip() is true and the point is outside of QQuickItem::clipRect(), its children are also omitted. (We stop the recursion, because any clipped-off portions of children under point are invisible.)
  • Ignore any item in a subscene that "belongs to" a different DeliveryAgent. (In current practice, this only happens in 2D scenes in Qt Quick 3D.) \endlist

The list returned from this function is the list of items that will be "visited" when delivering any event for which QPointerEvent::isBeginEvent() is true.

Definition at line 2185 of file qquickdeliveryagent.cpp.

◆ removeGrabber()

void QQuickDeliveryAgentPrivate::removeGrabber ( QQuickItem * grabber,
bool mouse = true,
bool touch = true,
bool cancel = false )

Ungrabs all touchpoint grabs and/or the mouse grab from the given item grabber.

This should not be called when processing a release event - that's redundant. It is called in other cases, when the points may not be released, but the item nevertheless must lose its grab due to becoming disabled, invisible, etc. QPointerEvent::setExclusiveGrabber() calls touchUngrabEvent() when all points are released, but if not all points are released, it cannot be sure whether to call touchUngrabEvent() or not; so we have to do it here.

Definition at line 277 of file qquickdeliveryagent.cpp.

◆ resetIfDoubleTapPrevented()

void QQuickDeliveryAgentPrivate::resetIfDoubleTapPrevented ( const QEventPoint & pressedPoint)

Definition at line 107 of file qquickdeliveryagent.cpp.

◆ sendFilteredMouseEvent()

bool QQuickDeliveryAgentPrivate::sendFilteredMouseEvent ( QEvent * event,
QQuickItem * receiver,
QQuickItem * filteringParent )

Allow filteringParent to filter event on behalf of receiver, via QQuickItem::childMouseEventFilter(). This happens right before we would send event to receiver.

Returns true only if event has been intercepted (by filteringParent or some other filtering ancestor) and should not be sent to receiver.

Unlike sendFilteredPointerEvent(), this version does not synthesize a mouse event from touch (presumably it's already an actual mouse event).

Definition at line 2899 of file qquickdeliveryagent.cpp.

◆ sendFilteredPointerEvent()

bool QQuickDeliveryAgentPrivate::sendFilteredPointerEvent ( QPointerEvent * event,
QQuickItem * receiver,
QQuickItem * filteringParent = nullptr )

Allow filteringParent to filter event on behalf of receiver, via QQuickItem::childMouseEventFilter(). This happens right before we would send event to receiver.

Returns true only if event has been intercepted (by filteringParent or some other filtering ancestor) and should not be sent to receiver.

Definition at line 2755 of file qquickdeliveryagent.cpp.

◆ sendFilteredPointerEventImpl()

bool QQuickDeliveryAgentPrivate::sendFilteredPointerEventImpl ( QPointerEvent * event,
QQuickItem * receiver,
QQuickItem * filteringParent )

The recursive implementation of sendFilteredPointerEvent().

Definition at line 2763 of file qquickdeliveryagent.cpp.

◆ sendHoverEvent()

bool QQuickDeliveryAgentPrivate::sendHoverEvent ( QEvent::Type type,
QQuickItem * item,
const QPointF & scenePos,
const QPointF & lastScenePos,
Qt::KeyboardModifiers modifiers,
ulong timestamp )

Definition at line 1074 of file qquickdeliveryagent.cpp.

◆ setFocusInScope()

void QQuickDeliveryAgentPrivate::setFocusInScope ( QQuickItem * scope,
QQuickItem * item,
Qt::FocusReason reason,
FocusOptions options = { } )

Set the focus inside scope to be item.

If the scope contains the active focus item, it will be changed to item. Calls notifyFocusChangesRecur for all changed items.

Definition at line 399 of file qquickdeliveryagent.cpp.

◆ touchToMouseEvent()

void QQuickDeliveryAgentPrivate::touchToMouseEvent ( QEvent::Type type,
const QEventPoint & p,
const QTouchEvent * touchEvent,
QMutableSinglePointEvent * mouseEvent )

Definition at line 58 of file qquickdeliveryagent.cpp.

◆ translateTouchEvent()

void QQuickDeliveryAgentPrivate::translateTouchEvent ( QTouchEvent * touchEvent)

Translates QEventPoint::scenePosition() in touchEvent to this window.

The item-local QEventPoint::position() is updated later, not here.

Definition at line 352 of file qquickdeliveryagent.cpp.

◆ updateFocusItemTransform()

void QQuickDeliveryAgentPrivate::updateFocusItemTransform ( )

Definition at line 702 of file qquickdeliveryagent.cpp.

Member Data Documentation

◆ activeFocusItem

QQuickItem* QQuickDeliveryAgentPrivate::activeFocusItem = nullptr

Definition at line 56 of file qquickdeliveryagent_p_p.h.

◆ allowChildEventFiltering

bool QQuickDeliveryAgentPrivate::allowChildEventFiltering = true

Definition at line 92 of file qquickdeliveryagent_p_p.h.

◆ compressedTouchCount

uchar QQuickDeliveryAgentPrivate::compressedTouchCount = 0

Definition at line 91 of file qquickdeliveryagent_p_p.h.

◆ currentEventDeliveryAgent

QQuickDeliveryAgent * QQuickDeliveryAgentPrivate::currentEventDeliveryAgent
static

Definition at line 99 of file qquickdeliveryagent_p_p.h.

◆ currentHoverId

uint QQuickDeliveryAgentPrivate::currentHoverId = 0

Definition at line 87 of file qquickdeliveryagent_p_p.h.

◆ delayedTouch

std::unique_ptr<QMutableTouchEvent> QQuickDeliveryAgentPrivate::delayedTouch

Definition at line 84 of file qquickdeliveryagent_p_p.h.

◆ eventsInDelivery

QStack<QPointerEvent *> QQuickDeliveryAgentPrivate::eventsInDelivery

Definition at line 79 of file qquickdeliveryagent_p_p.h.

◆ frameSynchronousHoverEnabled

bool QQuickDeliveryAgentPrivate::frameSynchronousHoverEnabled = true

Definition at line 93 of file qquickdeliveryagent_p_p.h.

◆ hasFiltered

QVector<QQuickItem *> QQuickDeliveryAgentPrivate::hasFiltered

Definition at line 81 of file qquickdeliveryagent_p_p.h.

◆ hoveredLeafItemFound

bool QQuickDeliveryAgentPrivate::hoveredLeafItemFound = false

Definition at line 94 of file qquickdeliveryagent_p_p.h.

◆ hoverItems

QFlatMap<QPointer<QQuickItem>, uint> QQuickDeliveryAgentPrivate::hoverItems

Definition at line 80 of file qquickdeliveryagent_p_p.h.

◆ isSubsceneAgent

bool QQuickDeliveryAgentPrivate::isSubsceneAgent = false

Definition at line 96 of file qquickdeliveryagent_p_p.h.

◆ knownPointingDevices

QList<const QPointingDevice *> QQuickDeliveryAgentPrivate::knownPointingDevices

Definition at line 85 of file qquickdeliveryagent_p_p.h.

◆ lastFocusReason

Qt::FocusReason QQuickDeliveryAgentPrivate::lastFocusReason = Qt::OtherFocusReason

Definition at line 102 of file qquickdeliveryagent_p_p.h.

◆ lastMousePosition

QPointF QQuickDeliveryAgentPrivate::lastMousePosition

Definition at line 122 of file qquickdeliveryagent_p_p.h.

◆ lastUngrabbed

QQuickItem* QQuickDeliveryAgentPrivate::lastUngrabbed = nullptr

Definition at line 78 of file qquickdeliveryagent_p_p.h.

◆ pointerEventRecursionGuard

int QQuickDeliveryAgentPrivate::pointerEventRecursionGuard = 0

Definition at line 103 of file qquickdeliveryagent_p_p.h.

◆ rootItem

QQuickItem* QQuickDeliveryAgentPrivate::rootItem = nullptr

Definition at line 54 of file qquickdeliveryagent_p_p.h.

◆ sceneTransform

QQuickDeliveryAgent::Transform* QQuickDeliveryAgentPrivate::sceneTransform = nullptr

Definition at line 111 of file qquickdeliveryagent_p_p.h.

◆ skipDelivery

QVector<QQuickItem *> QQuickDeliveryAgentPrivate::skipDelivery

Definition at line 82 of file qquickdeliveryagent_p_p.h.

◆ subsceneAgentsExist

bool QQuickDeliveryAgentPrivate::subsceneAgentsExist
static

Definition at line 97 of file qquickdeliveryagent_p_p.h.

◆ touchMouseDevice

const QPointingDevice* QQuickDeliveryAgentPrivate::touchMouseDevice = nullptr

Definition at line 107 of file qquickdeliveryagent_p_p.h.

◆ touchMouseId

int QQuickDeliveryAgentPrivate::touchMouseId = -1

Definition at line 105 of file qquickdeliveryagent_p_p.h.

◆ touchMousePressPos

QPoint QQuickDeliveryAgentPrivate::touchMousePressPos

Definition at line 109 of file qquickdeliveryagent_p_p.h.

◆ touchMousePressTimestamp

ulong QQuickDeliveryAgentPrivate::touchMousePressTimestamp = 0

Definition at line 108 of file qquickdeliveryagent_p_p.h.


The documentation for this class was generated from the following files: