8#if QT_CONFIG(graphicsview)
15#include <QtGui/qpointingdevice.h>
16#include "private/qapplication_p.h"
17#include "private/qevent_p.h"
18#include "private/qflickgesture_p.h"
27#ifdef QFLICKGESTURE_DEBUG
28# define qFGDebug qDebug
30# define qFGDebug while (false) qDebug
43#if QT_CONFIG(graphicsview)
69 , mouseTarget(
nullptr)
94 return !pressDelayEvent.
isNull();
99 if (!pressDelayEvent) {
103 mouseButton = pressDelayEvent->
button();
104 mouseEventSource = pressDelayEvent->
source();
105 qFGDebug(
"QFG: consuming/delaying mouse press");
107 qFGDebug(
"QFG: NOT consuming/delaying mouse press");
109 e->setAccepted(
true);
115 bool result = scrollerWasActive || scrollerIsActive;
118 if (pressDelayTimer) {
123 if (pressDelayEvent && mouseTarget && !scrollerIsActive) {
126 qFGDebug() <<
"QFG: re-sending mouse press (due to release) for " << mouseTarget;
129 qFGDebug() <<
"QFG: faking mouse release (due to release) for " << mouseTarget;
133 }
else if (mouseTarget && scrollerIsActive) {
137 pressDelayEvent.
reset(
nullptr);
138 mouseTarget =
nullptr;
144 qFGDebug(
"QFG: deleting delayed mouse press, since scroller was only intercepted");
145 if (pressDelayEvent) {
147 if (pressDelayTimer) {
151 pressDelayEvent.
reset(
nullptr);
153 mouseTarget =
nullptr;
158 if (pressDelayEvent) {
160 qFGDebug(
"QFG: deleting delayed mouse press, since scroller is active now");
161 if (pressDelayTimer) {
165 pressDelayEvent.
reset(
nullptr);
166 mouseTarget =
nullptr;
167 }
else if (mouseTarget) {
171 qFGDebug() <<
"QFG: sending a fake mouse release at far-far-away to " << mouseTarget;
173 mouseButton, eventButtons & ~mouseButton,
174 eventModifiers, mouseEventSource);
183 if (
e->timerId() == pressDelayTimer) {
184 if (pressDelayEvent && mouseTarget) {
185 qFGDebug() <<
"QFG: timer event: re-sending mouse press to " << mouseTarget;
188 pressDelayEvent.
reset(
nullptr);
190 if (pressDelayTimer) {
202#if QT_CONFIG(graphicsview)
216 qFGDebug() <<
"QFG: ungrabbing" << grabber;
232#if QT_CONFIG(graphicsview)
239 qFGDebug() <<
"QFG: re-grabbing" << grabber;
243 sendingEvent =
false;
277 d_func()->q_ptr =
this;
278 d_func()->receiver = receiver;
280 d_func()->button =
button;
305#if QT_CONFIG(graphicsview)
328 if (!monotonicTimer.isValid())
329 monotonicTimer.
start();
339#if QT_CONFIG(graphicsview)
340 QGraphicsObject *receiverGraphicsObject = qobject_cast<QGraphicsObject *>(
d->receiver);
350#if QT_CONFIG(graphicsview)
360 switch (
event->type()) {
373#if QT_CONFIG(graphicsview)
377 if (!receiverGraphicsObject)
382 mouseButtons = gsme->
buttons();
425 switch (
event->type()) {
427 if (me && me->
button() == button && me->
buttons() == button) {
436 if (me && me->
button() == button) {
442 if (me && me->
buttons() == button) {
448#if QT_CONFIG(graphicsview)
450 if (gsme && gsme->
button() == button && gsme->
buttons() == button) {
459 if (gsme && gsme->
button() == button) {
465 if (gsme && gsme->
buttons() == button) {
510 scrollerRegion =
QRect(
w->mapToGlobal(
QPoint(0, 0)),
w->size());
511#if QT_CONFIG(graphicsview)
512 }
else if (
QGraphicsObject *go = qobject_cast<QGraphicsObject *>(as->target())) {
513 if (
const auto *
scene = go->scene()) {
514 const auto goBoundingRectMappedToScene = go->mapToScene(go->boundingRect());
517 scrollerRegion |= gv->mapFromScene(goBoundingRectMappedToScene)
524 if (scrollerRegion.
contains(globalPos))
535 point =
w->mapFromGlobal(point.
toPoint());
536#if QT_CONFIG(graphicsview)
537 else if (
QGraphicsObject *go = qobject_cast<QGraphicsObject *>(
d->receiver))
538 point = go->mapFromScene(point);
556 ) && scrollerIsActive)
569 if (!scrollerWasDragging && !scrollerWasScrolling && scrollerIsActive)
578 switch (
event->type()) {
580#if QT_CONFIG(graphicsview)
585 if (pressDelay > 0) {
594 q->setHotSpot(globalPos);
599#if QT_CONFIG(graphicsview)
609#if QT_CONFIG(graphicsview)
638#include "moc_qflickgesture_p.cpp"
void timerEvent(QTimerEvent *e) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void scrollerBecameActive(Qt::KeyboardModifiers eventModifiers, Qt::MouseButtons eventButtons)
static PressDelayHandler * instance()
bool released(QEvent *e, bool scrollerWasActive, bool scrollerIsActive)
bool shouldEventBeIgnored(QEvent *) const
void scrollerWasIntercepted()
void pressed(QEvent *e, int delay)
void sendMouseEvent(QMouseEvent *me, int flags=0)
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or \nullptr if there is no Qt widget there.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
void start() noexcept
Starts this timer.
QPointF globalPosition
the global position of this point.
QPointF scenePosition
the scene position of this point.
QPointF scenePressPosition
the scene position at which this point was pressed.
Type
This enum type defines the valid event types in Qt.
@ GraphicsSceneMouseRelease
@ GraphicsSceneMousePress
Type type() const
Returns the event type.
QGesture * create(QObject *target) override
\reimp
void reset(QGesture *state) override
\reimp
QFlickGestureRecognizer(Qt::MouseButton button)
QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override
The QFlickGesture class describes a flicking gesture made by the user.The QFlickGesture is more compl...
QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent=nullptr)
virtual void reset(QGesture *state)
This function is called by the framework to reset a given gesture.
The QGesture class represents a gesture, containing properties that describe the corresponding user i...
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QGraphicsScene * scene() const
Returns the current scene for the item, or \nullptr if the item is not stored in a scene.
void setAcceptTouchEvents(bool enabled)
The QGraphicsObject class provides a base class for all graphics items that require signals,...
quint64 timestamp() const
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
Qt::MouseButton button() const
Returns the mouse button (if any) that caused the event.
Qt::MouseEventSource source() const
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifiers in use at the time the event was sent.
QPoint screenPos() const
Returns the mouse cursor position in screen coordinates.
Qt::MouseButtons buttons() const
Returns the combination of mouse buttons that were pressed at the time the event was sent.
QPointF scenePos() const
Returns the mouse cursor position in scene coordinates.
QList< QGraphicsView * > views() const
Returns a list of all the views that display this scene.
QGraphicsItem * mouseGrabberItem() const
Returns the current mouse grabber item, or \nullptr if no item is currently grabbing the mouse.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
Qt::MouseEventSource source() const
int startTimer(int interval, Qt::TimerType timerType=Qt::CoarseTimer)
This is an overloaded function that will start a timer of type timerType and a timeout of interval mi...
QObject * parent() const
Returns a pointer to the parent object.
void killTimer(int id)
Kills the timer with timer identifier, id.
\inmodule QtCore\reentrant
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
const QPointingDevice * pointingDevice() const
Returns the source device from which this event originates.
void setTimestamp(quint64 timestamp) override
const QList< QEventPoint > & points() const
Returns a list of points in this pointer event.
\inmodule QtCore\reentrant
The QRegion class specifies a clip region for a painter.
bool contains(const QPoint &p) const
Returns true if the region contains the point p; otherwise returns false.
QRegion translated(int dx, int dy) const
T * data() const noexcept
Returns the value of the pointer referenced by this object.
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
QPointF globalPosition() const
Returns the position of the point in this event on the screen or virtual desktop.
Qt::MouseButton button() const
Returns the button that caused the event.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
The QTouchEvent class contains parameters that describe a touch event.
qreal toReal(bool *ok=nullptr) const
Returns the variant as a qreal if the variant has userType() \l QMetaType::Double,...
Combined button and popup list for selecting options.
@ MouseEventNotSynthesized
static jboolean copy(JNIEnv *, jobject)
static QMouseEvent * copyMouseEvent(QEvent *e)
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
GLfloat GLfloat GLfloat w
[0]
GLdouble GLdouble GLdouble GLdouble q
#define QT_CONFIG(feature)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent