diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-12-03 15:49:12 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-12-04 15:14:04 +0100 |
commit | 6ad3445f1e159d9beea936b66d267dcaacdc5d6c (patch) | |
tree | cb5c15974eac3be21d61e9661bacb9b7c9db50b4 /src/quick/items/qquicklistview.cpp | |
parent | 6a5f905317aee731153947c4cb884f6f1b00fdab (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/qquicklistview.cpp')
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 17 |
1 files changed, 17 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" |