diff options
Diffstat (limited to 'src/quicktemplates2/qquickdrawer.cpp')
-rw-r--r-- | src/quicktemplates2/qquickdrawer.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index 2ca0f6c3..94b8aea7 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -169,6 +169,17 @@ QQuickDrawerPrivate::QQuickDrawerPrivate() setEdge(Qt::LeftEdge); } +qreal QQuickDrawerPrivate::offsetAt(const QPointF &point) const +{ + qreal offset = positionAt(point) - position; + + // don't jump when dragged open + if (offset > 0 && position > 0 && !contains(point)) + offset = 0; + + return offset; +} + qreal QQuickDrawerPrivate::positionAt(const QPointF &point) const { Q_Q(const QQuickDrawer); @@ -322,11 +333,7 @@ bool QQuickDrawerPrivate::grabMouse(QQuickItem *item, QMouseEvent *event) if (!grabber || !grabber->keepMouseGrab()) { popupItem->grabMouse(); popupItem->setKeepMouseGrab(true); - offset = positionAt(movePoint) - position; - - // don't jump when dragged open - if (offset > 0 && position > 0 && !contains(movePoint)) - offset = 0; + offset = offsetAt(movePoint); } } @@ -371,11 +378,7 @@ bool QQuickDrawerPrivate::grabTouch(QQuickItem *item, QTouchEvent *event) if (overThreshold) { popupItem->setKeepTouchGrab(true); - offset = positionAt(movePoint) - position; - - // don't jump when dragged open - if (offset > 0 && position > 0 && !contains(movePoint)) - offset = 0; + offset = offsetAt(movePoint); } } |