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
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#include <QtCore/qpointer.h>
25
26#ifndef QT_NO_GESTURES
27
28#include <functional>
29
31
32class QBasicTimer;
33class QGraphicsObject;
35{
37public:
40
43
44 bool filterEvent(QWidget *receiver, QEvent *event);
45 bool filterEvent(QObject *receiver, QEvent *event);
46#if QT_CONFIG(graphicsview)
47 bool filterEvent(QGraphicsObject *receiver, QEvent *event);
48#endif // QT_CONFIG(graphicsview)
49
51
52 static QGestureManager *instance(InstanceCreation ic = ForceCreation); // declared in qapplication.cpp
53 static bool gesturePending(QObject *o);
54
56
57 void recycle(QGesture *gesture);
58
59protected:
60 bool filterEventThroughContexts(const QMultiMap<QObject *, Qt::GestureType> &contexts,
61 QEvent *event);
62
63private:
64 QMultiMap<Qt::GestureType, QGestureRecognizer *> m_recognizers;
65
66 QSet<QGesture *> m_activeGestures;
67 QSet<QGesture *> m_maybeGestures;
68
69 struct ObjectGesture
70 {
72 Qt::GestureType gesture;
73
74 ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { }
75 inline bool operator<(const ObjectGesture &rhs) const
76 {
77 if (std::less<QObject *>{}(object, rhs.object))
78 return true;
79 if (object == rhs.object)
80 return gesture < rhs.gesture;
81 return false;
82 }
83 };
84
85 QMap<ObjectGesture, QList<QGesture *> > m_objectGestures;
86 QHash<QGesture *, QGestureRecognizer *> m_gestureToRecognizer;
87 QHash<QGesture *, QObject *> m_gestureOwners;
88
89 QHash<QGesture *, QPointer<QWidget> > m_gestureTargets;
90
91 int m_lastCustomGestureId;
92
93 QHash<QGestureRecognizer *, QSet<QGesture *> > m_obsoleteGestures;
94 QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
95 QSet<QGesture *> m_gesturesToDelete;
96 void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
97
98 QGesture *getState(QObject *widget, QGestureRecognizer *recognizer,
99 Qt::GestureType gesture);
100 void deliverEvents(const QSet<QGesture *> &gestures,
101 QSet<QGesture *> *undeliveredGestures);
102 void getGestureTargets(const QSet<QGesture*> &gestures,
103 QHash<QWidget *, QList<QGesture *> > *conflicts,
104 QHash<QWidget *, QList<QGesture *> > *normal);
105
106 void cancelGesturesForChildren(QGesture *originatingGesture);
107};
108
110
111#endif // QT_NO_GESTURES
112
113#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)
QGestureManager(QObject *parent)
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:820
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
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
GLuint object
[3]
GLenum type
GLenum target
GLboolean GLboolean g
struct _cl_event * event
#define Q_OBJECT