aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/handlers/qquickpointersinglehandler.cpp8
-rw-r--r--src/quick/handlers/qquickpointersinglehandler_p.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/src/quick/handlers/qquickpointersinglehandler.cpp b/src/quick/handlers/qquickpointersinglehandler.cpp
index 020d3ef7de..5ad60291dd 100644
--- a/src/quick/handlers/qquickpointersinglehandler.cpp
+++ b/src/quick/handlers/qquickpointersinglehandler.cpp
@@ -56,6 +56,7 @@ QQuickPointerSingleHandler::QQuickPointerSingleHandler(QObject *parent)
, m_rotation(0)
, m_pressure(0)
, m_acceptedButtons(Qt::AllButtons)
+ , m_ignoreAdditionalPoints(false)
{
}
@@ -83,7 +84,7 @@ bool QQuickPointerSingleHandler::wantsPointerEvent(QQuickPointerEvent *event)
}
}
if (point) {
- if (candidatePointCount == 1) {
+ if (candidatePointCount == 1 || (candidatePointCount > 1 && m_ignoreAdditionalPoints)) {
point->setAccepted();
return true;
} else {
@@ -192,6 +193,11 @@ void QQuickPointerSingleHandler::onGrabChanged(QQuickPointerHandler *grabber, QQ
emit singlePointGrabChanged();
}
+void QQuickPointerSingleHandler::setIgnoreAdditionalPoints(bool v)
+{
+ m_ignoreAdditionalPoints = v;
+}
+
void QQuickPointerSingleHandler::setPressedButtons(Qt::MouseButtons buttons)
{
if (buttons != m_pressedButtons) {
diff --git a/src/quick/handlers/qquickpointersinglehandler_p.h b/src/quick/handlers/qquickpointersinglehandler_p.h
index 9c854c4d0d..466de1a1eb 100644
--- a/src/quick/handlers/qquickpointersinglehandler_p.h
+++ b/src/quick/handlers/qquickpointersinglehandler_p.h
@@ -106,6 +106,8 @@ protected:
QQuickEventPoint *currentPoint(QQuickPointerEvent *ev) { return ev->pointById(m_pointId); }
void onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point) override;
+ void setIgnoreAdditionalPoints(bool v = true);
+
private:
void setPressedButtons(Qt::MouseButtons buttons);
void reset();
@@ -122,6 +124,7 @@ private:
qreal m_pressure;
QSizeF m_ellipseDiameters;
Qt::MouseButtons m_acceptedButtons;
+ bool m_ignoreAdditionalPoints : 1;
};
QT_END_NAMESPACE