Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickpointhandler.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include <private/qquickwindow_p.h>
6#include <QDebug>
7
9
84{
86}
87
89{
90 // On press, we want it unless a sibling of the same type also does.
92 for (const QObject *grabber : event->passiveGrabbers(point)) {
93 if (grabber && grabber->parent() == parent() &&
94 grabber->metaObject()->className() == metaObject()->className())
95 return false;
96 }
97 return true;
98 }
99 // If we've already been interested in a point, stay interested, even if it has strayed outside bounds.
100 return (point.state() != QEventPoint::Pressed &&
102}
103
105{
106 switch (point.state()) {
109 (static_cast<const QSinglePointEvent *>(event)->buttons() & acceptedButtons()) != Qt::NoButton) {
111 setActive(true);
112 }
113 break;
116 (static_cast<const QSinglePointEvent *>(event)->buttons() & acceptedButtons()) == Qt::NoButton)
117 setActive(false);
118 break;
119 default:
120 break;
121 }
122 point.setAccepted(false); // Just lurking... don't interfere with propagation
125}
126
128{
129 return QVector2D(point().position() - point().pressPosition());
130}
131
254
255#include "moc_qquickpointhandler_p.cpp"
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
\inmodule QtCore
Definition qobject.h:90
A base class for pointer events.
Definition qevent.h:73
static bool isTouchEvent(const QPointerEvent *ev)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
bool wantsEventPoint(const QPointerEvent *event, const QEventPoint &point) override
Returns true if the given point (as part of event) could be relevant at all to this handler,...
void handleEventPoint(QPointerEvent *event, QEventPoint &point) override
QQuickPointHandler(QQuickItem *parent=nullptr)
\qmltype PointHandler \instantiates QQuickPointHandler \inherits SinglePointHandler \inqmlmodule QtQu...
virtual bool wantsEventPoint(const QPointerEvent *event, const QEventPoint &point)
Returns true if the given point (as part of event) could be relevant at all to this handler,...
void setPassiveGrab(QPointerEvent *event, const QEventPoint &point, bool grab=true)
Acquire or give up a passive grab of the given point, according to the grab state.
virtual void handleEventPoint(QPointerEvent *event, QEventPoint &point)
A base class for pointer events containing a single point, such as mouse events.
Definition qevent.h:108
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
Combined button and popup list for selecting options.
@ NoButton
Definition qnamespace.h:56
struct _cl_event * event
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define emit
obj metaObject() -> className()
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent