Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickmultipointhandler_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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
4#ifndef QQUICKPOINTERMULTIHANDLER_H
5#define QQUICKPOINTERMULTIHANDLER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/qevent.h>
19#include <QtQuick/qquickitem.h>
20
23
25
27
28class Q_QUICK_PRIVATE_EXPORT QQuickMultiPointHandler : public QQuickPointerDeviceHandler
29{
31 Q_PROPERTY(int minimumPointCount READ minimumPointCount WRITE setMinimumPointCount NOTIFY minimumPointCountChanged FINAL)
32 Q_PROPERTY(int maximumPointCount READ maximumPointCount WRITE setMaximumPointCount NOTIFY maximumPointCountChanged FINAL)
33 Q_PROPERTY(QQuickHandlerPoint centroid READ centroid NOTIFY centroidChanged FINAL)
34
35public:
36 explicit QQuickMultiPointHandler(QQuickItem *parent = nullptr, int minimumPointCount = 2, int maximumPointCount = -1);
37
38 int minimumPointCount() const;
39 void setMinimumPointCount(int c);
40
41 int maximumPointCount() const;
42 void setMaximumPointCount(int maximumPointCount);
43
44 const QQuickHandlerPoint &centroid() const;
45
50
51protected:
52 struct PointData {
53 PointData() : id(0), angle(0) {}
57 };
58
61 void onActiveChanged() override;
63 QList<QQuickHandlerPoint> &currentPoints();
64 QQuickHandlerPoint &mutableCentroid();
65 bool hasCurrentPoints(QPointerEvent *event);
67 qreal averageTouchPointDistance(const QPointF &ref);
68 qreal averageStartingDistance(const QPointF &ref);
71 QVector<PointData> angles(const QPointF &ref) const;
72 static qreal averageAngleDelta(const QVector<PointData> &old, const QVector<PointData> &newAngles);
73 void acceptPoints(const QVector<QEventPoint> &points);
74 bool grabPoints(QPointerEvent *event, const QVector<QEventPoint> &points);
75 void moveTarget(QPointF pos);
76
77 Q_DECLARE_PRIVATE(QQuickMultiPointHandler)
78};
79
81
82#endif // QQUICKPOINTERMULTIHANDLER_H
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
Definition qlist.h:74
\inmodule QtCore\reentrant
Definition qpoint.h:214
A base class for pointer events.
Definition qevent.h:73
GrabTransition
This enum represents a transition of exclusive or passive grab from one object (possibly nullptr) to ...
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
qreal averageStartingAngle(const QPointF &ref)
qreal averageTouchPointAngle(const QPointF &ref)
bool wantsPointerEvent(QPointerEvent *event) override
It is the responsibility of this function to decide whether the event could be relevant at all to thi...
virtual void onGrabChanged(QQuickPointerHandler *grabber, QPointingDevice::GrabTransition transition, QPointerEvent *event, QEventPoint &point)
Notification that the grab has changed in some way which is relevant to this handler.
virtual void handlePointerEventImpl(QPointerEvent *event)
This function can be overridden to implement whatever behavior a specific subclass is intended to hav...
Combined button and popup list for selecting options.
GLenum GLuint id
[7]
GLfloat angle
GLint ref
struct _cl_event * event
GLfixed GLfixed GLint GLint GLfixed points
const GLubyte * c
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SIGNALS
unsigned long long quint64
Definition qtypes.h:56
double qreal
Definition qtypes.h:92
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent