Rename single and multi pointer handler classnames
Renames: QQuickPointerSingleHandler -> QQuickSinglePointHandler QQuickMultiPointerHandler -> QQuickMultiPointHandler Change-Id: I10c54944f85ca7cac374ebc6241d61793e2d38bf Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
72f320a266
commit
7c54910a66
|
@ -1,20 +1,20 @@
|
|||
HEADERS += \
|
||||
$$PWD/qquickdraghandler_p.h \
|
||||
$$PWD/qquickhandlersmodule_p.h \
|
||||
$$PWD/qquickmultipointerhandler_p.h \
|
||||
$$PWD/qquickmultipointhandler_p.h \
|
||||
$$PWD/qquickpinchhandler_p.h \
|
||||
$$PWD/qquickpointerdevicehandler_p.h \
|
||||
$$PWD/qquickpointerhandler_p.h \
|
||||
$$PWD/qquickpointersinglehandler_p.h \
|
||||
$$PWD/qquicksinglepointhandler_p.h \
|
||||
$$PWD/qquicktaphandler_p.h \
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qquickdraghandler.cpp \
|
||||
$$PWD/qquickhandlersmodule.cpp \
|
||||
$$PWD/qquickmultipointerhandler.cpp \
|
||||
$$PWD/qquickmultipointhandler.cpp \
|
||||
$$PWD/qquickpinchhandler.cpp \
|
||||
$$PWD/qquickpointerdevicehandler.cpp \
|
||||
$$PWD/qquickpointerhandler.cpp \
|
||||
$$PWD/qquickpointersinglehandler.cpp \
|
||||
$$PWD/qquicksinglepointhandler.cpp \
|
||||
$$PWD/qquicktaphandler.cpp \
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
|
|||
*/
|
||||
|
||||
QQuickDragHandler::QQuickDragHandler(QObject *parent)
|
||||
: QQuickPointerSingleHandler(parent)
|
||||
: QQuickSinglePointHandler(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ bool QQuickDragHandler::wantsEventPoint(QQuickEventPoint *point)
|
|||
{
|
||||
// If we've already been interested in a point, stay interested, even if it has strayed outside bounds.
|
||||
return ((point->state() != QQuickEventPoint::Pressed && this->point().id() == point->pointId())
|
||||
|| QQuickPointerSingleHandler::wantsEventPoint(point));
|
||||
|| QQuickSinglePointHandler::wantsEventPoint(point));
|
||||
}
|
||||
|
||||
void QQuickDragHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
|
||||
|
@ -79,7 +79,7 @@ void QQuickDragHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEvent
|
|||
// In case the grab got handled over from another grabber, we might not get the Press
|
||||
initializeTargetStartPos(point);
|
||||
enforceConstraints();
|
||||
QQuickPointerSingleHandler::onGrabChanged(grabber, stateChange, point);
|
||||
QQuickSinglePointHandler::onGrabChanged(grabber, stateChange, point);
|
||||
}
|
||||
|
||||
void QQuickDragHandler::onActiveChanged()
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qquickpointersinglehandler_p.h"
|
||||
#include "qquicksinglepointhandler_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -85,7 +85,7 @@ private:
|
|||
bool m_enabled;
|
||||
};
|
||||
|
||||
class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickPointerSingleHandler
|
||||
class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickSinglePointHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qquickmultipointerhandler_p.h"
|
||||
#include "qquickmultipointhandler_p.h"
|
||||
#include <private/qquickitem_p.h>
|
||||
#include <QLineF>
|
||||
#include <QMouseEvent>
|
||||
|
@ -50,18 +50,18 @@ QT_BEGIN_NAMESPACE
|
|||
for the type of handler which requires and acts upon a specific number
|
||||
of multiple touchpoints.
|
||||
*/
|
||||
QQuickMultiPointerHandler::QQuickMultiPointerHandler(QObject *parent, int requiredPointCount)
|
||||
QQuickMultiPointHandler::QQuickMultiPointHandler(QObject *parent, int requiredPointCount)
|
||||
: QQuickPointerDeviceHandler(parent)
|
||||
, m_requiredPointCount(requiredPointCount)
|
||||
, m_pointDistanceThreshold(0)
|
||||
{
|
||||
}
|
||||
|
||||
QQuickMultiPointerHandler::~QQuickMultiPointerHandler()
|
||||
QQuickMultiPointHandler::~QQuickMultiPointHandler()
|
||||
{
|
||||
}
|
||||
|
||||
bool QQuickMultiPointerHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
||||
bool QQuickMultiPointHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
||||
{
|
||||
if (!QQuickPointerDeviceHandler::wantsPointerEvent(event))
|
||||
return false;
|
||||
|
@ -76,7 +76,7 @@ bool QQuickMultiPointerHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
|||
return ret;
|
||||
}
|
||||
|
||||
QVector<QQuickEventPoint *> QQuickMultiPointerHandler::eligiblePoints(QQuickPointerEvent *event)
|
||||
QVector<QQuickEventPoint *> QQuickMultiPointHandler::eligiblePoints(QQuickPointerEvent *event)
|
||||
{
|
||||
QVector<QQuickEventPoint *> ret;
|
||||
int c = event->pointCount();
|
||||
|
@ -99,7 +99,7 @@ QVector<QQuickEventPoint *> QQuickMultiPointerHandler::eligiblePoints(QQuickPoin
|
|||
return ret;
|
||||
}
|
||||
|
||||
void QQuickMultiPointerHandler::setRequiredPointCount(int c)
|
||||
void QQuickMultiPointHandler::setRequiredPointCount(int c)
|
||||
{
|
||||
if (m_requiredPointCount == c)
|
||||
return;
|
||||
|
@ -108,7 +108,7 @@ void QQuickMultiPointerHandler::setRequiredPointCount(int c)
|
|||
emit requiredPointCountChanged();
|
||||
}
|
||||
|
||||
void QQuickMultiPointerHandler::setPointDistanceThreshold(qreal pointDistanceThreshold)
|
||||
void QQuickMultiPointHandler::setPointDistanceThreshold(qreal pointDistanceThreshold)
|
||||
{
|
||||
if (m_pointDistanceThreshold == pointDistanceThreshold)
|
||||
return;
|
||||
|
@ -117,7 +117,7 @@ void QQuickMultiPointerHandler::setPointDistanceThreshold(qreal pointDistanceThr
|
|||
emit pointDistanceThresholdChanged();
|
||||
}
|
||||
|
||||
bool QQuickMultiPointerHandler::sameAsCurrentPoints(QQuickPointerEvent *event)
|
||||
bool QQuickMultiPointHandler::sameAsCurrentPoints(QQuickPointerEvent *event)
|
||||
{
|
||||
bool ret = true;
|
||||
int c = event->pointCount();
|
||||
|
@ -140,7 +140,7 @@ bool QQuickMultiPointerHandler::sameAsCurrentPoints(QQuickPointerEvent *event)
|
|||
}
|
||||
|
||||
// TODO make templates for these functions somehow?
|
||||
QPointF QQuickMultiPointerHandler::touchPointCentroid()
|
||||
QPointF QQuickMultiPointHandler::touchPointCentroid()
|
||||
{
|
||||
QPointF ret;
|
||||
if (Q_UNLIKELY(m_currentPoints.size() == 0))
|
||||
|
@ -150,7 +150,7 @@ QPointF QQuickMultiPointerHandler::touchPointCentroid()
|
|||
return ret / m_currentPoints.size();
|
||||
}
|
||||
|
||||
QVector2D QQuickMultiPointerHandler::touchPointCentroidVelocity()
|
||||
QVector2D QQuickMultiPointHandler::touchPointCentroidVelocity()
|
||||
{
|
||||
QVector2D ret;
|
||||
if (Q_UNLIKELY(m_currentPoints.size() == 0))
|
||||
|
@ -160,7 +160,7 @@ QVector2D QQuickMultiPointerHandler::touchPointCentroidVelocity()
|
|||
return ret / m_currentPoints.size();
|
||||
}
|
||||
|
||||
qreal QQuickMultiPointerHandler::averageTouchPointDistance(const QPointF &ref)
|
||||
qreal QQuickMultiPointHandler::averageTouchPointDistance(const QPointF &ref)
|
||||
{
|
||||
qreal ret = 0;
|
||||
if (Q_UNLIKELY(m_currentPoints.size() == 0))
|
||||
|
@ -170,7 +170,7 @@ qreal QQuickMultiPointerHandler::averageTouchPointDistance(const QPointF &ref)
|
|||
return ret / m_currentPoints.size();
|
||||
}
|
||||
|
||||
qreal QQuickMultiPointerHandler::averageStartingDistance(const QPointF &ref)
|
||||
qreal QQuickMultiPointHandler::averageStartingDistance(const QPointF &ref)
|
||||
{
|
||||
// TODO cache it in setActive()?
|
||||
qreal ret = 0;
|
||||
|
@ -181,7 +181,7 @@ qreal QQuickMultiPointerHandler::averageStartingDistance(const QPointF &ref)
|
|||
return ret / m_currentPoints.size();
|
||||
}
|
||||
|
||||
QVector<QQuickMultiPointerHandler::PointData> QQuickMultiPointerHandler::angles(const QPointF &ref) const
|
||||
QVector<QQuickMultiPointHandler::PointData> QQuickMultiPointHandler::angles(const QPointF &ref) const
|
||||
{
|
||||
QVector<PointData> angles;
|
||||
angles.reserve(m_currentPoints.count());
|
||||
|
@ -192,7 +192,7 @@ QVector<QQuickMultiPointerHandler::PointData> QQuickMultiPointerHandler::angles(
|
|||
return angles;
|
||||
}
|
||||
|
||||
qreal QQuickMultiPointerHandler::averageAngleDelta(const QVector<PointData> &old, const QVector<PointData> &newAngles)
|
||||
qreal QQuickMultiPointHandler::averageAngleDelta(const QVector<PointData> &old, const QVector<PointData> &newAngles)
|
||||
{
|
||||
qreal avgAngleDelta = 0;
|
||||
int numSamples = 0;
|
||||
|
@ -224,13 +224,13 @@ qreal QQuickMultiPointerHandler::averageAngleDelta(const QVector<PointData> &old
|
|||
return avgAngleDelta;
|
||||
}
|
||||
|
||||
void QQuickMultiPointerHandler::acceptPoints(const QVector<QQuickEventPoint *> &points)
|
||||
void QQuickMultiPointHandler::acceptPoints(const QVector<QQuickEventPoint *> &points)
|
||||
{
|
||||
for (QQuickEventPoint* point : points)
|
||||
point->setAccepted();
|
||||
}
|
||||
|
||||
bool QQuickMultiPointerHandler::grabPoints(QVector<QQuickEventPoint *> points)
|
||||
bool QQuickMultiPointHandler::grabPoints(QVector<QQuickEventPoint *> points)
|
||||
{
|
||||
bool canGrab = true;
|
||||
for (QQuickEventPoint* point : points) {
|
|
@ -57,15 +57,15 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_AUTOTEST_EXPORT QQuickMultiPointerHandler : public QQuickPointerDeviceHandler
|
||||
class Q_AUTOTEST_EXPORT QQuickMultiPointHandler : public QQuickPointerDeviceHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int requiredPointCount READ requiredPointCount WRITE setRequiredPointCount NOTIFY requiredPointCountChanged)
|
||||
Q_PROPERTY(qreal pointDistanceThreshold READ pointDistanceThreshold WRITE setPointDistanceThreshold NOTIFY pointDistanceThresholdChanged)
|
||||
|
||||
public:
|
||||
explicit QQuickMultiPointerHandler(QObject *parent = 0, int requiredPointCount = 2);
|
||||
~QQuickMultiPointerHandler();
|
||||
explicit QQuickMultiPointHandler(QObject *parent = 0, int requiredPointCount = 2);
|
||||
~QQuickMultiPointHandler();
|
||||
|
||||
int requiredPointCount() const { return m_requiredPointCount; }
|
||||
void setRequiredPointCount(int c);
|
||||
|
@ -107,6 +107,6 @@ protected:
|
|||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QML_DECLARE_TYPE(QQuickMultiPointerHandler)
|
||||
QML_DECLARE_TYPE(QQuickMultiPointHandler)
|
||||
|
||||
#endif // QQUICKPOINTERMULTIHANDLER_H
|
|
@ -63,7 +63,7 @@ Q_LOGGING_CATEGORY(lcPinchHandler, "qt.quick.handler.pinch")
|
|||
*/
|
||||
|
||||
QQuickPinchHandler::QQuickPinchHandler(QObject *parent)
|
||||
: QQuickMultiPointerHandler(parent, 2)
|
||||
: QQuickMultiPointHandler(parent, 2)
|
||||
, m_activeScale(1)
|
||||
, m_activeRotation(0)
|
||||
, m_activeTranslation(0,0)
|
||||
|
|
|
@ -53,12 +53,12 @@
|
|||
|
||||
#include "qquickitem.h"
|
||||
#include "qevent.h"
|
||||
#include "qquickmultipointerhandler_p.h"
|
||||
#include "qquickmultipointhandler_p.h"
|
||||
#include <private/qquicktranslate_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_AUTOTEST_EXPORT QQuickPinchHandler : public QQuickMultiPointerHandler
|
||||
class Q_AUTOTEST_EXPORT QQuickPinchHandler : public QQuickMultiPointHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(qreal minimumScale READ minimumScale WRITE setMinimumScale NOTIFY minimumScaleChanged)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qquickpointersinglehandler_p.h"
|
||||
#include "qquicksinglepointhandler_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH_TARGET)
|
||||
|
@ -50,14 +50,14 @@ Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH_TARGET)
|
|||
Override handleEventPoint() to implement a single-point handler.
|
||||
*/
|
||||
|
||||
QQuickPointerSingleHandler::QQuickPointerSingleHandler(QObject *parent)
|
||||
QQuickSinglePointHandler::QQuickSinglePointHandler(QObject *parent)
|
||||
: QQuickPointerDeviceHandler(parent)
|
||||
, m_acceptedButtons(Qt::LeftButton)
|
||||
, m_ignoreAdditionalPoints(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool QQuickPointerSingleHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
||||
bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
||||
{
|
||||
if (!QQuickPointerDeviceHandler::wantsPointerEvent(event))
|
||||
return false;
|
||||
|
@ -113,7 +113,7 @@ bool QQuickPointerSingleHandler::wantsPointerEvent(QQuickPointerEvent *event)
|
|||
return m_pointInfo.m_id;
|
||||
}
|
||||
|
||||
void QQuickPointerSingleHandler::handlePointerEventImpl(QQuickPointerEvent *event)
|
||||
void QQuickSinglePointHandler::handlePointerEventImpl(QQuickPointerEvent *event)
|
||||
{
|
||||
QQuickPointerDeviceHandler::handlePointerEventImpl(event);
|
||||
QQuickEventPoint *currentPoint = event->pointById(m_pointInfo.m_id);
|
||||
|
@ -158,12 +158,12 @@ void QQuickPointerSingleHandler::handlePointerEventImpl(QQuickPointerEvent *even
|
|||
}
|
||||
}
|
||||
|
||||
bool QQuickPointerSingleHandler::wantsEventPoint(QQuickEventPoint *point)
|
||||
bool QQuickSinglePointHandler::wantsEventPoint(QQuickEventPoint *point)
|
||||
{
|
||||
return parentContains(point);
|
||||
}
|
||||
|
||||
void QQuickPointerSingleHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
|
||||
void QQuickSinglePointHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
|
||||
{
|
||||
if (grabber != this)
|
||||
return;
|
||||
|
@ -191,19 +191,19 @@ void QQuickPointerSingleHandler::onGrabChanged(QQuickPointerHandler *grabber, QQ
|
|||
emit singlePointGrabChanged();
|
||||
}
|
||||
|
||||
void QQuickPointerSingleHandler::setIgnoreAdditionalPoints(bool v)
|
||||
void QQuickSinglePointHandler::setIgnoreAdditionalPoints(bool v)
|
||||
{
|
||||
m_ignoreAdditionalPoints = v;
|
||||
}
|
||||
|
||||
void QQuickPointerSingleHandler::moveTarget(QPointF pos, QQuickEventPoint *point)
|
||||
void QQuickSinglePointHandler::moveTarget(QPointF pos, QQuickEventPoint *point)
|
||||
{
|
||||
target()->setPosition(pos);
|
||||
m_pointInfo.m_scenePosition = point->scenePos();
|
||||
m_pointInfo.m_position = target()->mapFromScene(m_pointInfo.m_scenePosition);
|
||||
}
|
||||
|
||||
void QQuickPointerSingleHandler::setAcceptedButtons(Qt::MouseButtons buttons)
|
||||
void QQuickSinglePointHandler::setAcceptedButtons(Qt::MouseButtons buttons)
|
||||
{
|
||||
if (m_acceptedButtons == buttons)
|
||||
return;
|
||||
|
@ -212,7 +212,7 @@ void QQuickPointerSingleHandler::setAcceptedButtons(Qt::MouseButtons buttons)
|
|||
emit acceptedButtonsChanged();
|
||||
}
|
||||
|
||||
void QQuickPointerSingleHandler::reset()
|
||||
void QQuickSinglePointHandler::reset()
|
||||
{
|
||||
setActive(false);
|
||||
m_pointInfo.reset();
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQuickPointerSingleHandler;
|
||||
class QQuickSinglePointHandler;
|
||||
|
||||
class Q_QUICK_PRIVATE_EXPORT QQuickHandlerPoint {
|
||||
Q_GADGET
|
||||
|
@ -102,17 +102,17 @@ private:
|
|||
qreal m_rotation;
|
||||
qreal m_pressure;
|
||||
QSizeF m_ellipseDiameters;
|
||||
friend class QQuickPointerSingleHandler;
|
||||
friend class QQuickSinglePointHandler;
|
||||
};
|
||||
|
||||
class Q_QUICK_PRIVATE_EXPORT QQuickPointerSingleHandler : public QQuickPointerDeviceHandler
|
||||
class Q_QUICK_PRIVATE_EXPORT QQuickSinglePointHandler : public QQuickPointerDeviceHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
|
||||
Q_PROPERTY(QQuickHandlerPoint point READ point NOTIFY pointChanged)
|
||||
public:
|
||||
explicit QQuickPointerSingleHandler(QObject *parent = 0);
|
||||
virtual ~QQuickPointerSingleHandler() { }
|
||||
explicit QQuickSinglePointHandler(QObject *parent = 0);
|
||||
virtual ~QQuickSinglePointHandler() { }
|
||||
|
||||
Qt::MouseButtons acceptedButtons() const { return m_acceptedButtons; }
|
||||
void setAcceptedButtons(Qt::MouseButtons buttons);
|
||||
|
@ -149,6 +149,6 @@ private:
|
|||
QT_END_NAMESPACE
|
||||
|
||||
QML_DECLARE_TYPE(QQuickHandlerPoint)
|
||||
QML_DECLARE_TYPE(QQuickPointerSingleHandler)
|
||||
QML_DECLARE_TYPE(QQuickSinglePointHandler)
|
||||
|
||||
#endif // QQUICKPOINTERSINGLEHANDLER_H
|
|
@ -78,7 +78,7 @@ int QQuickTapHandler::m_touchMultiTapDistanceSquared(-1);
|
|||
*/
|
||||
|
||||
QQuickTapHandler::QQuickTapHandler(QObject *parent)
|
||||
: QQuickPointerSingleHandler(parent)
|
||||
: QQuickSinglePointHandler(parent)
|
||||
, m_pressed(false)
|
||||
, m_gesturePolicy(ReleaseWithinBounds)
|
||||
, m_tapCount(0)
|
||||
|
@ -305,7 +305,7 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QQuickEventPoint *poi
|
|||
|
||||
void QQuickTapHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
|
||||
{
|
||||
QQuickPointerSingleHandler::onGrabChanged(grabber, stateChange, point);
|
||||
QQuickSinglePointHandler::onGrabChanged(grabber, stateChange, point);
|
||||
bool isCanceled = stateChange == QQuickEventPoint::CancelGrabExclusive || stateChange == QQuickEventPoint::CancelGrabPassive;
|
||||
if (grabber == this && (isCanceled || point->state() == QQuickEventPoint::Released))
|
||||
setPressed(false, isCanceled, point);
|
||||
|
|
|
@ -53,12 +53,12 @@
|
|||
|
||||
#include "qquickitem.h"
|
||||
#include "qevent.h"
|
||||
#include "qquickpointersinglehandler_p.h"
|
||||
#include "qquicksinglepointhandler_p.h"
|
||||
#include <QtCore/qbasictimer.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_AUTOTEST_EXPORT QQuickTapHandler : public QQuickPointerSingleHandler
|
||||
class Q_AUTOTEST_EXPORT QQuickTapHandler : public QQuickSinglePointHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isPressed READ isPressed NOTIFY pressedChanged)
|
||||
|
|
Loading…
Reference in New Issue