diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-27 11:09:14 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-27 14:33:36 +0000 |
commit | 6060986368fcd14559141233719c767b97992590 (patch) | |
tree | 01292b4d88719ec77a073cea23f99ebfc870245a /src | |
parent | 52ea821c43dfd6afc9ad21a9066c1eb39937c40d (diff) |
Add QQuickOverlayPrivate::startDrag()
Change-Id: I9558f82cb7330e451c043e25c9a140f49eefa219
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickoverlay.cpp | 32 | ||||
-rw-r--r-- | src/quicktemplates2/qquickoverlay_p_p.h | 1 |
2 files changed, 20 insertions, 13 deletions
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index a13661e9..985c8f3d 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -181,24 +181,30 @@ QQuickOverlayPrivate::QQuickOverlayPrivate() { } +bool QQuickOverlayPrivate::startDrag(QEvent *event) +{ + if (allDrawers.isEmpty()) + return false; + + const QVector<QQuickDrawer *> drawers = stackingOrderDrawers(); + for (QQuickDrawer *drawer : drawers) { + QQuickDrawerPrivate *p = QQuickDrawerPrivate::get(drawer); + if (p->startDrag(event)) { + setMouseGrabberPopup(drawer); + return true; + } + } + + return false; +} + bool QQuickOverlayPrivate::handlePress(QEvent *event) { Q_Q(QQuickOverlay); emit q->pressed(); - if (!allDrawers.isEmpty()) { - // the overlay background was pressed, so there are no modal popups open. - // test if the press point lands on any drawer's drag margin - - const QVector<QQuickDrawer *> drawers = stackingOrderDrawers(); - for (QQuickDrawer *drawer : drawers) { - QQuickDrawerPrivate *p = QQuickDrawerPrivate::get(drawer); - if (p->startDrag(event)) { - setMouseGrabberPopup(drawer); - return true; - } - } - } + if (startDrag(event)) + return true; if (!mouseGrabberPopup) { // allow non-modal popups to close themselves, diff --git a/src/quicktemplates2/qquickoverlay_p_p.h b/src/quicktemplates2/qquickoverlay_p_p.h index 82065c79..f3ff0a52 100644 --- a/src/quicktemplates2/qquickoverlay_p_p.h +++ b/src/quicktemplates2/qquickoverlay_p_p.h @@ -70,6 +70,7 @@ public: return overlay->d_func(); } + bool startDrag(QEvent *event); bool handlePress(QEvent *event); bool handleMove(QEvent *event); bool handleRelease(QEvent *event); |