diff options
Diffstat (limited to 'src/quicktemplates2/qquickdrawer.cpp')
-rw-r--r-- | src/quicktemplates2/qquickdrawer.cpp | 28 |
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(); |