aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdrawer.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-09-11 14:03:47 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-09-11 14:03:47 +0200
commitc32c776bf4bd0bc601cb78f9814036cb40b33b52 (patch)
treea390a1b5909c0396271be5f29b818ba114328e70 /src/quicktemplates2/qquickdrawer.cpp
parent4997773a6ed0ea9908cd67ab0335d2ae177a6320 (diff)
parentd3aef722da533c3b100ba653498c79986a44c9f9 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/quicktemplates2/qquicklabel.cpp src/quicktemplates2/qquicktextarea.cpp src/quicktemplates2/qquicktextfield.cpp Change-Id: Ibbf6bc48972f58fbc6779a87ac9e2434c56c4db8
Diffstat (limited to 'src/quicktemplates2/qquickdrawer.cpp')
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 96d48f08..328778ca 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -256,7 +256,7 @@ void QQuickDrawerPrivate::resizeOverlay()
dimmer->setSize(geometry.size());
}
-static bool isWithinDragMargin(QQuickDrawer *drawer, const QPointF &pos)
+static bool isWithinDragMargin(const QQuickDrawer *drawer, const QPointF &pos)
{
switch (drawer->edge()) {
case Qt::LeftEdge:
@@ -403,6 +403,30 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event)
static const qreal openCloseVelocityThreshold = 300;
+bool QQuickDrawerPrivate::blockInput(QQuickItem *item, const QPointF &point) const
+{
+ Q_Q(const QQuickDrawer);
+
+ // We want all events, if mouse/touch is already grabbed.
+ if (popupItem->keepMouseGrab() || popupItem->keepTouchGrab())
+ return true;
+
+ // Don't block input to drawer's children/content.
+ if (popupItem->isAncestorOf(item))
+ return false;
+
+ // Don't block outside a drawer's background dimming
+ if (dimmer && !dimmer->contains(dimmer->mapFromScene(point)))
+ return false;
+
+ // Accept all events within drag area.
+ if (isWithinDragMargin(q, point))
+ return true;
+
+ // Accept all other events if drawer is modal.
+ return modal;
+}
+
bool QQuickDrawerPrivate::handlePress(QQuickItem *item, const QPointF &point, ulong timestamp)
{
offset = 0;
@@ -421,7 +445,7 @@ bool QQuickDrawerPrivate::handleMove(QQuickItem *item, const QPointF &point, ulo
return false;
// limit/reset the offset to the edge of the drawer when pushed from the outside
- if (qFuzzyCompare(position, 1.0) && !contains(point))
+ if (qFuzzyCompare(position, qreal(1.0)) && !contains(point))
offset = 0;
bool isGrabbed = popupItem->keepMouseGrab() || popupItem->keepTouchGrab();