Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
7#include <QDebug>
8#include <QtCore/qpointer.h>
9
11
89
91{
92 // On press, we want it unless a sibling of the same type also does.
94 for (const QObject *grabber : event->passiveGrabbers(point)) {
95 if (grabber && grabber->parent() == parent() &&
96 grabber->metaObject()->className() == metaObject()->className())
97 return false;
98 }
99 return true;
100 }
101 // If we've already been interested in a point, stay interested, even if it has strayed outside bounds.
102 return (point.state() != QEventPoint::Pressed &&
104}
105
107{
108 switch (point.state()) {
111 (static_cast<const QSinglePointEvent *>(event)->buttons() & acceptedButtons()) != Qt::NoButton) {
113 setActive(true);
114 }
115 break;
118 (static_cast<const QSinglePointEvent *>(event)->buttons() & acceptedButtons()) == Qt::NoButton)
119 setActive(false);
120 break;
121 default:
122 break;
123 }
124 point.setAccepted(false); // Just lurking... don't interfere with propagation
127}
128
130{
131 return QVector2D(point().position() - point().pressPosition());
132}
133
256
257#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:103
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:63
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:109
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:57
struct _cl_event * event
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define emit
obj metaObject() -> className()