diff options
Diffstat (limited to 'src/quicktemplates2/qquickoverlay.cpp')
-rw-r--r-- | src/quicktemplates2/qquickoverlay.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index cf72c8a6..e9f8801d 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -34,10 +34,12 @@ ** ****************************************************************************/ +#include "qquickcontrol_p_p.h" #include "qquickoverlay_p.h" #include "qquickoverlay_p_p.h" #include "qquickpopupitem_p_p.h" #include "qquickpopup_p_p.h" +#include "qquickdrawer_p.h" #include "qquickdrawer_p_p.h" #include "qquickapplicationwindow_p.h" #include <QtQml/qqmlinfo.h> @@ -50,7 +52,7 @@ QT_BEGIN_NAMESPACE /*! \qmltype Overlay \inherits Item - \instantiates QQuickOverlay +//! \instantiates QQuickOverlay \inqmlmodule QtQuick.Controls \since 5.10 \brief A window overlay for popups. @@ -126,11 +128,6 @@ bool QQuickOverlayPrivate::startDrag(QEvent *event, const QPointF &pos) return false; } -static bool isTouchEvent(QEvent *event) -{ - return event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchUpdate || event->type() == QEvent::TouchEnd; -} - bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuickPopup *target) { if (target) { @@ -139,7 +136,18 @@ bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuick return true; } return false; - } else if (!mouseGrabberPopup || isTouchEvent(event)) { + } + + switch (event->type()) { + default: { + if (mouseGrabberPopup) + break; +#if QT_CONFIG(quicktemplates2_multitouch) + Q_FALLTHROUGH(); + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: +#endif // allow non-modal popups to close themselves, // and non-dimming modal popups to block the event const auto popups = stackingOrderPopups(); @@ -149,6 +157,8 @@ bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuick return true; } } + break; + } } event->ignore(); @@ -247,7 +257,7 @@ void QQuickOverlayPrivate::removePopup(QQuickPopup *popup) { Q_Q(QQuickOverlay); allPopups.removeOne(popup); - if (allDrawers.removeOne(static_cast<QQuickDrawer *>(popup))) + if (allDrawers.removeOne(qobject_cast<QQuickDrawer *>(popup))) q->setVisible(!allDrawers.isEmpty() || !q->childItems().isEmpty()); } @@ -333,7 +343,6 @@ void QQuickOverlay::setModal(QQmlComponent *modal) if (d->modal == modal) return; - delete d->modal; d->modal = modal; emit modalChanged(); } @@ -350,7 +359,6 @@ void QQuickOverlay::setModeless(QQmlComponent *modeless) if (d->modeless == modeless) return; - delete d->modeless; d->modeless = modeless; emit modelessChanged(); } @@ -662,7 +670,6 @@ void QQuickOverlayAttached::setModal(QQmlComponent *modal) if (d->modal == modal) return; - delete d->modal; d->modal = modal; emit modalChanged(); } @@ -695,7 +702,6 @@ void QQuickOverlayAttached::setModeless(QQmlComponent *modeless) if (d->modeless == modeless) return; - delete d->modeless; d->modeless = modeless; emit modelessChanged(); } |