diff options
author | ChunLin Wang <wangchunlin@uniontech.com> | 2021-08-17 20:07:31 +0800 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-08-20 13:31:45 +0000 |
commit | 9ba4c6beeff394d8526503b43ba471d82c27df9c (patch) | |
tree | 88b7a8cd051c745731301a5b66bd3c0a1efc714c /src/widgets/graphicsview | |
parent | b7150d22c8ea6349b5d1fd61d5059e0fbe2745ed (diff) |
Fix QScroller::scrollTo failing in QGraphicsView with movable item
When forcing software scrolling through QScroller::scrollTo,
it will start from (0, 0). QGraphicsViewPrivate::canStartScrollingAt
should consider the locationof points, not just the flags of item.
Fixes: QTBUG-70255
Pick-to: 5.15 6.1 6.2
Change-Id: Iebdd5568baa3bdb41c705204dadb2895cfe9c0e2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 6d1fb8aab7..b6ed0080d7 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -614,7 +614,7 @@ bool QGraphicsViewPrivate::canStartScrollingAt(const QPoint &startPos) const const QGraphicsItem *childItem = q->itemAt(startPos); - if (childItem && (childItem->flags() & QGraphicsItem::ItemIsMovable)) + if (!startPos.isNull() && childItem && (childItem->flags() & QGraphicsItem::ItemIsMovable)) return false; return QAbstractScrollAreaPrivate::canStartScrollingAt(startPos); |