aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickpincharea_p_p.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-10-28 07:51:26 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-10-30 12:19:53 +0100
commit7b911a65d238d68177a69feb773b3c9d803f6ef4 (patch)
treeb16a6954d72a91782992786c5296b7528da7cf45 /src/quick/items/qquickpincharea_p_p.h
parent0fa6091b1076bc3cc58303ff00d43efdad32b8ad (diff)
Modernize event handling in PinchArea
Worrying about the window's touchmouse is really not a relevant concern for a touch-only item; and grabs are done by grabbing the specific points that the pincharea chooses to handle, not by grabbing the touchmouse. We simply didn't have suitable API in Qt 5. Also some drive-by fixes: better packing and initialization in QQuickPinchAreaPrivate; and the stealMouse variable has only been set, not checked, for a long time, so we can remove it. Remove unimplemented handlePress() and handleRelease(). Change-Id: Ia76dc9b9974f663b13c4bb9dac32efe8ed7815c5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/quick/items/qquickpincharea_p_p.h')
-rw-r--r--src/quick/items/qquickpincharea_p_p.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/quick/items/qquickpincharea_p_p.h b/src/quick/items/qquickpincharea_p_p.h
index 986aa53900..fdba06f070 100644
--- a/src/quick/items/qquickpincharea_p_p.h
+++ b/src/quick/items/qquickpincharea_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtSG module of the Qt Toolkit.
@@ -64,11 +64,7 @@ class QQuickPinchAreaPrivate : public QQuickItemPrivate
Q_DECLARE_PUBLIC(QQuickPinchArea)
public:
QQuickPinchAreaPrivate()
- : enabled(true), stealMouse(false), inPinch(false)
- , pinchRejected(false), pinchActivated(false), initPinch(false)
- , pinch(0), pinchStartDist(0), pinchStartScale(1.0)
- , pinchLastScale(1.0), pinchStartRotation(0.0), pinchStartAngle(0.0)
- , pinchLastAngle(0.0), pinchRotation(0.0)
+ : enabled(true), inPinch(false), pinchRejected(false), pinchActivated(false), initPinch(false)
{
}
@@ -77,34 +73,33 @@ public:
void init()
{
Q_Q(QQuickPinchArea);
- q->setAcceptedMouseButtons(Qt::LeftButton);
+ q->setAcceptTouchEvents(true);
q->setFiltersChildMouseEvents(true);
}
bool enabled : 1;
- bool stealMouse : 1;
bool inPinch : 1;
bool pinchRejected : 1;
bool pinchActivated : 1;
bool initPinch : 1;
- QQuickPinch *pinch;
+ int id1 = -1;
+ QQuickPinch *pinch = nullptr;
QPointF sceneStartPoint1;
QPointF sceneStartPoint2;
QPointF lastPoint1;
QPointF lastPoint2;
- qreal pinchStartDist;
- qreal pinchStartScale;
- qreal pinchLastScale;
- qreal pinchStartRotation;
- qreal pinchStartAngle;
- qreal pinchLastAngle;
- qreal pinchRotation;
+ qreal pinchStartDist = 0;
+ qreal pinchStartScale = 1;
+ qreal pinchLastScale = 1;
+ qreal pinchStartRotation = 0;
+ qreal pinchStartAngle = 0;
+ qreal pinchLastAngle = 0;
+ qreal pinchRotation = 0;
QPointF sceneStartCenter;
QPointF pinchStartCenter;
QPointF sceneLastCenter;
QPointF pinchStartPos;
QList<QEventPoint> touchPoints;
- int id1;
};
QT_END_NAMESPACE