diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-08 22:02:57 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-08 22:29:44 +0200 |
commit | e94c57d109d474d9450f39098d51737e8c2f466c (patch) | |
tree | 49f0c25990a62210fe26ec4e50fb92e3664468b2 /src | |
parent | 04bc9d83f22a7266fb0caf53c2c3da0d9b06fef4 (diff) |
Don't assume the event given to childMouseEventFilter() is QPointerEvent
It can also be an UngrabMouse event, a plain QEvent, sent from
QQuickWindowPrivate::onGrabChanged(). So we have to test
isPointerEvent() before casting, rather than asserting beforehand.
Amends 9ce346411eb5bd71ae84647999030ae47c3c544a to fix a crash.
Change-Id: I1d169b4e8c8a58f3736a3d95dfc43fa21e123403
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 8c65962174..f8bedfa4a4 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2444,8 +2444,8 @@ bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) { Q_D(QQuickFlickable); - Q_ASSERT(e->isPointerEvent()); - if (!isVisible() || !isEnabled() || !isInteractive() || !d->wantsPointerEvent(static_cast<QPointerEvent *>(e))) { + if (!isVisible() || !isEnabled() || !isInteractive() || + (e->isPointerEvent() && !d->wantsPointerEvent(static_cast<QPointerEvent *>(e)))) { d->cancelInteraction(); return QQuickItem::childMouseEventFilter(i, e); } |