aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-10-07 14:35:56 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-10-08 10:13:27 +0200
commit9ce346411eb5bd71ae84647999030ae47c3c544a (patch)
treed382c8002dcc9005d9c0919951c24b599a129626 /src
parent8d9819734516a2fe0853acfd0b2cfd3364465c7a (diff)
Amend QQFlickablePrivate::wantsPointerEvent() to take QPointerEvent
...now that we're done with the cherry-pick to 5.15. Amends 6857ad3e686a5e2b45d28a7f47dca3210608da50. Task-number: QTBUG-74046 Task-number: QTBUG-85302 Change-Id: I3c2ec091976bcfc170ff58d8fcd226dcdf4c90d2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickflickable.cpp3
-rw-r--r--src/quick/items/qquickflickable_p_p.h3
-rw-r--r--src/quick/items/qquicklistview.cpp18
3 files changed, 6 insertions, 18 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index f29153967a..8c65962174 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -2444,7 +2444,8 @@ bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event)
bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e)
{
Q_D(QQuickFlickable);
- if (!isVisible() || !isEnabled() || !isInteractive() || !d->wantsPointerEvent(e)) {
+ Q_ASSERT(e->isPointerEvent());
+ if (!isVisible() || !isEnabled() || !isInteractive() || !d->wantsPointerEvent(static_cast<QPointerEvent *>(e))) {
d->cancelInteraction();
return QQuickItem::childMouseEventFilter(i, e);
}
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index c85ccb733f..93b78d90de 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -208,8 +208,7 @@ public:
void addPointerHandler(QQuickPointerHandler *h) override;
- // TODO Qt 6: QPointerEvent
- virtual bool wantsPointerEvent(const QEvent *) { return true; }
+ virtual bool wantsPointerEvent(const QPointerEvent *) { return true; }
public:
QQuickItem *contentItem;
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index ced9e27855..420ab620ab 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -146,7 +146,7 @@ public:
void fixupHeader();
void fixupHeaderCompleted();
- bool wantsPointerEvent(const QEvent *event) override;
+ bool wantsPointerEvent(const QPointerEvent *event) override;
QQuickListView::Orientation orient;
qreal visiblePos;
@@ -3828,24 +3828,12 @@ QQuickListViewAttached *QQuickListView::qmlAttachedProperties(QObject *obj)
/*! \internal
Prevents clicking or dragging through floating headers (QTBUG-74046).
*/
-bool QQuickListViewPrivate::wantsPointerEvent(const QEvent *event)
+bool QQuickListViewPrivate::wantsPointerEvent(const QPointerEvent *event)
{
Q_Q(const QQuickListView);
bool ret = true;
- QPointF pos;
- // TODO switch not needed in Qt 6: use points().first().position()
- switch (event->type()) {
- case QEvent::Wheel:
- pos = static_cast<const QWheelEvent *>(event)->position();
- break;
- case QEvent::MouseButtonPress:
- pos = static_cast<const QMouseEvent *>(event)->position();
- break;
- default:
- break;
- }
-
+ QPointF pos = event->points().first().position();
if (!pos.isNull()) {
if (auto header = q->headerItem()) {
if (q->headerPositioning() != QQuickListView::InlineHeader &&