aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-12-03 15:49:12 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2019-12-04 15:14:04 +0100
commit6ad3445f1e159d9beea936b66d267dcaacdc5d6c (patch)
treecb5c15974eac3be21d61e9661bacb9b7c9db50b4 /src/quick/items
parent6a5f905317aee731153947c4cb884f6f1b00fdab (diff)
Don't allow dragging a ListView through a floating header or footer
If the header or footer positioning is Overlay or PullBack, the list delegates appear to scroll underneath it. The header or footer can contain interactive content. If a mouse or touch press happens to "fall through" that, it should not be possible to drag the ListView contents from there. [ChangeLog][QtQuick][ListView] ListView no longer allows the user to press on an Overlay or PullBack header or footer and start scrolling, but only on the content delegates. Fixes: QTBUG-74046 Change-Id: I4d06c789286be2691d098aeebb10a57b2a335744 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquicklistview.cpp17
-rw-r--r--src/quick/items/qquicklistview_p.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 9206628716..4dbb2b792c 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -3608,6 +3608,23 @@ QQuickListViewAttached *QQuickListView::qmlAttachedProperties(QObject *obj)
return new QQuickListViewAttached(obj);
}
+bool QQuickListView::contains(const QPointF &point) const
+{
+ bool ret = QQuickItemView::contains(point);
+ // QTBUG-74046: if a mouse press "falls through" a floating header or footer, don't allow dragging the list from there
+ if (ret) {
+ if (auto header = headerItem()) {
+ if (headerPositioning() != QQuickListView::InlineHeader && header->contains(mapToItem(header, point)))
+ ret = false;
+ }
+ if (auto footer = footerItem()) {
+ if (footerPositioning() != QQuickListView::InlineFooter && footer->contains(mapToItem(footer, point)))
+ ret = false;
+ }
+ }
+ return ret;
+}
+
QT_END_NAMESPACE
#include "moc_qquicklistview_p.cpp"
diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h
index 1c72a10190..be21b93155 100644
--- a/src/quick/items/qquicklistview_p.h
+++ b/src/quick/items/qquicklistview_p.h
@@ -179,6 +179,8 @@ public:
static QQuickListViewAttached *qmlAttachedProperties(QObject *);
+ bool contains(const QPointF &point) const override;
+
public Q_SLOTS:
void incrementCurrentIndex();
void decrementCurrentIndex();