diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-28 15:50:14 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-28 17:45:46 +0000 |
commit | f71d22d6e077410c42291486e15b67215baa0739 (patch) | |
tree | 20ae1093a73c4952be1d6923ab4153fbb98a93b8 /src/quicktemplates2/qquickdrawer.cpp | |
parent | c3ddc2e8124b7b03279d6d3a1b76858cc7763af1 (diff) |
Add QQuickPopupPrivate::contains() for convenience
This logic seemed to be repeated in several places...
Change-Id: I3b74140c7d7e44fa6ada12cf7844d96086d99e47
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickdrawer.cpp')
-rw-r--r-- | src/quicktemplates2/qquickdrawer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index 44500bd3..b896c142 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -308,7 +308,7 @@ bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event) } // Don't be too eager to steal presses outside the drawer (QTBUG-53929) - if (overThreshold && qFuzzyCompare(position, qreal(1.0)) && !popupItem->contains(popupItem->mapFromScene(movePoint))) { + if (overThreshold && qFuzzyCompare(position, qreal(1.0)) && !contains(movePoint)) { if (edge == Qt::LeftEdge || edge == Qt::RightEdge) overThreshold = qAbs(movePoint.x() - q->width()) < dragMargin; else @@ -323,7 +323,7 @@ bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event) offset = positionAt(movePoint) - position; // don't jump when dragged open - if (offset > 0 && position > 0 && !popupItem->contains(popupItem->mapFromScene(movePoint))) + if (offset > 0 && position > 0 && !contains(movePoint)) offset = 0; } } @@ -358,7 +358,7 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event) } // Don't be too eager to steal presses outside the drawer (QTBUG-53929) - if (overThreshold && qFuzzyCompare(position, qreal(1.0)) && !popupItem->contains(popupItem->mapFromScene(movePoint))) { + if (overThreshold && qFuzzyCompare(position, qreal(1.0)) && !contains(movePoint)) { if (edge == Qt::LeftEdge || edge == Qt::RightEdge) overThreshold = qAbs(movePoint.x() - q->width()) < dragMargin; else @@ -370,7 +370,7 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event) offset = positionAt(movePoint) - position; // don't jump when dragged open - if (offset > 0 && position > 0 && !popupItem->contains(popupItem->mapFromScene(movePoint))) + if (offset > 0 && position > 0 && !contains(movePoint)) offset = 0; } } @@ -399,7 +399,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) && !popupItem->contains(popupItem->mapFromScene(point))) + if (qFuzzyCompare(position, 1.0) && !contains(point)) offset = 0; bool isGrabbed = popupItem->keepMouseGrab() || popupItem->keepTouchGrab(); |