Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qgesturemanager_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 QGESTUREMANAGER_P_H
5#define QGESTUREMANAGER_P_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 for the convenience
12// of other Qt classes. 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 <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "qobject.h"
20#include "qbasictimer.h"
21#include "private/qwidget_p.h"
22#include "qgesturerecognizer.h"
23
24#ifndef QT_NO_GESTURES
25
26#include <functional>
27
29
30class QBasicTimer;
31class QGraphicsObject;
33{
35public:
38
41
42 bool filterEvent(QWidget *receiver, QEvent *event);
43 bool filterEvent(QObject *receiver, QEvent *event);
44#if QT_CONFIG(graphicsview)
45 bool filterEvent(QGraphicsObject *receiver, QEvent *event);
46#endif // QT_CONFIG(graphicsview)
47
49
50 static QGestureManager *instance(InstanceCreation ic = ForceCreation); // declared in qapplication.cpp
51 static bool gesturePending(QObject *o);
52
54
55 void recycle(QGesture *gesture);
56
57protected:
59 QEvent *event);
60
61private:
63
64 QSet<QGesture *> m_activeGestures;
65 QSet<QGesture *> m_maybeGestures;
66
67 struct ObjectGesture
68 {
70 Qt::GestureType gesture;
71
72 ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { }
73 inline bool operator<(const ObjectGesture &rhs) const
74 {
75 if (std::less<QObject *>{}(object, rhs.object))
76 return true;
77 if (object == rhs.object)
78 return gesture < rhs.gesture;
79 return false;
80 }
81 };
82
84 QHash<QGesture *, QGestureRecognizer *> m_gestureToRecognizer;
85 QHash<QGesture *, QObject *> m_gestureOwners;
86
87 QHash<QGesture *, QPointer<QWidget> > m_gestureTargets;
88
89 int m_lastCustomGestureId;
90
92 QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
93 QSet<QGesture *> m_gesturesToDelete;
94 void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
95
96 QGesture *getState(QObject *widget, QGestureRecognizer *recognizer,
97 Qt::GestureType gesture);
98 void deliverEvents(const QSet<QGesture *> &gestures,
99 QSet<QGesture *> *undeliveredGestures);
100 void getGestureTargets(const QSet<QGesture*> &gestures,
101 QHash<QWidget *, QList<QGesture *> > *conflicts,
102 QHash<QWidget *, QList<QGesture *> > *normal);
103
104 void cancelGesturesForChildren(QGesture *originatingGesture);
105};
106
108
109#endif // QT_NO_GESTURES
110
111#endif // QGESTUREMANAGER_P_H
\inmodule QtCore
Definition qbasictimer.h:18
\inmodule QtCore
Definition qcoreevent.h:45
void recycle(QGesture *gesture)
Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer)
bool filterEventThroughContexts(const QMultiMap< QObject *, Qt::GestureType > &contexts, QEvent *event)
static bool gesturePending(QObject *o)
bool filterEvent(QWidget *receiver, QEvent *event)
void unregisterGestureRecognizer(Qt::GestureType type)
static QGestureManager * instance(InstanceCreation ic=ForceCreation)
void cleanupCachedGestures(QObject *target, Qt::GestureType type)
The QGestureRecognizer class provides the infrastructure for gesture recognition.\inmodule QtWidgets.
The QGesture class represents a gesture, containing properties that describe the corresponding user i...
Definition qgesture.h:29
The QGraphicsObject class provides a base class for all graphics items that require signals,...
\inmodule QtCore
Definition qhash.h:818
Definition qlist.h:74
Definition qmap.h:186
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
Definition qset.h:18
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
Combined button and popup list for selecting options.
GestureType
constexpr bool operator<(const timespec &t1, const timespec &t2)
GLuint object
[3]
GLenum type
GLenum target
GLboolean GLboolean g
struct _cl_event * event
#define Q_OBJECT