aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickdraghandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/handlers/qquickdraghandler.cpp')
-rw-r--r--src/quick/handlers/qquickdraghandler.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp
index 3d807e0f2d..5e9d6d8230 100644
--- a/src/quick/handlers/qquickdraghandler.cpp
+++ b/src/quick/handlers/qquickdraghandler.cpp
@@ -52,7 +52,7 @@ Q_LOGGING_CATEGORY(lcDragHandler, "qt.quick.handler.drag")
At this time, drag-and-drop is not yet supported.
- \sa Drag, MouseArea
+ \sa Drag, MouseArea, {Qt Quick Examples - Pointer Handlers}
*/
QQuickDragHandler::QQuickDragHandler(QQuickItem *parent)
@@ -95,13 +95,13 @@ void QQuickDragHandler::onGrabChanged(QQuickPointerHandler *grabber, QPointingDe
This property holds the snap mode.
- The snap mode configures snapping of the \l target item's center to the event point.
+ The snap mode configures snapping of the \l target item's center to the \l eventPoint.
Possible values:
\value DragHandler.SnapNever Never snap
- \value DragHandler.SnapAuto The \l target snaps if the event point was pressed outside of the \l target
+ \value DragHandler.SnapAuto The \l target snaps if the \l eventPoint was pressed outside of the \l target
item \e and the \l target is a descendant of \l {PointerHandler::}{parent} item (default)
- \value DragHandler.SnapWhenPressedOutsideTarget The \l target snaps if the event point was pressed outside of the \l target
+ \value DragHandler.SnapWhenPressedOutsideTarget The \l target snaps if the \l eventPoint was pressed outside of the \l target
\value DragHandler.SnapAlways Always snap
*/
QQuickDragHandler::SnapMode QQuickDragHandler::snapMode() const
@@ -184,7 +184,9 @@ void QQuickDragHandler::handlePointerEventImpl(QPointerEvent *event)
// and in approximately the same direction
qreal minAngle = 361;
qreal maxAngle = -361;
- bool allOverThreshold = !event->isEndEvent();
+ bool allOverThreshold = QQuickDeliveryAgentPrivate::isTouchEvent(event) ?
+ static_cast<QTouchEvent *>(event)->touchPointStates() != QEventPoint::Released :
+ !event->isEndEvent();
QVector<QEventPoint> chosenPoints;
if (event->isBeginEvent())
@@ -264,17 +266,6 @@ void QQuickDragHandler::handlePointerEventImpl(QPointerEvent *event)
}
}
-void QQuickDragHandler::enforceConstraints()
-{
- if (!target() || !target()->parentItem())
- return;
- QPointF pos = target()->position();
- QPointF copy(pos);
- enforceAxisConstraints(&pos);
- if (pos != copy)
- target()->setPosition(pos);
-}
-
void QQuickDragHandler::enforceAxisConstraints(QPointF *localPos)
{
if (m_xAxis.enabled())