aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2022-12-09 18:40:54 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-19 14:56:35 +0000
commit8142a7944f7d4765cfaeddb7bf57edeed36e7b88 (patch)
tree6aef50c233dda9a41a3152f09739addfaeeb409e /src
parentf456d5311d1c4766a4f633def354d00beec77ca8 (diff)
Flickable: prevent fixup() from being called while dragging
A previous patch 5647527a8cde84b51fff66fc482f02435770b3dd causes a regression. The purpose of the patch, that caused this regression, was to update the pressPos variables, in cases where the contentItem's geometry was modified externally, while a user were dragging the contentItem around. The mistake that was made, was how width and height changes were handled. We had previously added logic in setContentWidth() and setContentHeight() that would call fixup() (with immediate fixupMode) to ensure that the contentItem would immediately be repositioned inside the flickable's viewport, if the contentItem was being dragged. It turns out that setContentWidth() and setContentHeight() are being called from QQuickItemViewPrivate::updateViewport(), which happens quite often, while dragging. This would make fixup() and dragging constantly interfere with each other, since they'd not always agree on a specific position for the contentItem. This patch reverts the changes made to setContentWidth() and setContentHeight(), since it turns out that those changes weren't necessary after all. QQuickFlickablePrivate::itemGeometryChanged() only calls viewportMoved() on x and y changes anyways. Done-with: Jan Arve Sæther <jan-arve.saether@qt.io> Done-with: Santhosh Kumar Selvaraj <santhosh.kumar.selvaraj@qt.io> Fixes: QTBUG-109140 Change-Id: I0bddf8685d3afc1ae04b2c092212d3c1bd742c3b Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit b307bf3c4f63c6e04874a972c747f18e18ddc199) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickflickable.cpp8
-rw-r--r--src/quick/items/qquickflickable_p_p.h1
2 files changed, 3 insertions, 6 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index a17ee64c60..4ddbfa509a 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -2254,11 +2254,9 @@ void QQuickFlickable::setContentWidth(qreal w)
d->contentItem->setWidth(w);
d->hData.markExtentsDirty();
// Make sure that we're entirely in view.
- if ((!d->pressed && !d->hData.moving && !d->vData.moving) || d->hData.dragging) {
- d->hData.contentPositionChangedExternallyDuringDrag = d->hData.dragging;
+ if (!d->pressed && !d->hData.moving && !d->vData.moving) {
d->fixupMode = QQuickFlickablePrivate::Immediate;
d->fixupX();
- d->hData.contentPositionChangedExternallyDuringDrag = false;
} else if (!d->pressed && d->hData.fixingUp) {
d->fixupMode = QQuickFlickablePrivate::ExtentChanged;
d->fixupX();
@@ -2285,11 +2283,9 @@ void QQuickFlickable::setContentHeight(qreal h)
d->contentItem->setHeight(h);
d->vData.markExtentsDirty();
// Make sure that we're entirely in view.
- if ((!d->pressed && !d->hData.moving && !d->vData.moving) || d->vData.dragging) {
- d->vData.contentPositionChangedExternallyDuringDrag = d->vData.dragging;
+ if (!d->pressed && !d->hData.moving && !d->vData.moving) {
d->fixupMode = QQuickFlickablePrivate::Immediate;
d->fixupY();
- d->vData.contentPositionChangedExternallyDuringDrag = false;
} else if (!d->pressed && d->vData.fixingUp) {
d->fixupMode = QQuickFlickablePrivate::ExtentChanged;
d->fixupY();
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index a96f2780d9..a0c3d4ad6c 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -120,6 +120,7 @@ public:
dragStartOffset = 0;
fixingUp = false;
inOvershoot = false;
+ contentPositionChangedExternallyDuringDrag = false;
}
void markExtentsDirty() {