summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2019-08-26 18:17:20 +0300
committerKonstantin Ritt <ritt.ks@gmail.com>2019-09-13 15:42:29 +0300
commit44a522445c94583e8d8502b9da3de217b6f075d5 (patch)
treeaa9e1c1437bf27edd1ac6f6de0c6e4850b4affb0
parenta5be4ae50c40f938ca8660296362fc06cc8273b1 (diff)
QQuickOverlay: micro optimization for disabled multitouch support
avoid checking every press event to be one of touch events type when touch events are not delivered at all Change-Id: I1ed91fa124608d8a006cf2f5256ad68294dd465f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index cf72c8a6..3f358706 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -126,11 +126,6 @@ bool QQuickOverlayPrivate::startDrag(QEvent *event, const QPointF &pos)
return false;
}
-static bool isTouchEvent(QEvent *event)
-{
- return event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchUpdate || event->type() == QEvent::TouchEnd;
-}
-
bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuickPopup *target)
{
if (target) {
@@ -139,7 +134,18 @@ bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuick
return true;
}
return false;
- } else if (!mouseGrabberPopup || isTouchEvent(event)) {
+ }
+
+ switch (event->type()) {
+ default: {
+ if (mouseGrabberPopup)
+ break;
+#if QT_CONFIG(quicktemplates2_multitouch)
+ Q_FALLTHROUGH();
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+#endif
// allow non-modal popups to close themselves,
// and non-dimming modal popups to block the event
const auto popups = stackingOrderPopups();
@@ -149,6 +155,8 @@ bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuick
return true;
}
}
+ break;
+ }
}
event->ignore();