aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2019-04-02 09:14:17 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2019-05-02 13:30:07 +0000
commit55c497ecf47894c602c1b4a08099ac63546b9260 (patch)
tree10382a8370d024e178edeb4fe0e4f34961ea6fa8 /src/quick/items
parent1db6782d6081fa54e7c951c21ac7c8953d2c9bfb (diff)
QQuickTableView: protect fixup() from being called while resizing the content view
Calling the base class implementation of fixup might move the content view and start animations etc, which will cause glitches. So ensure we don't do this when we adjust the content size internally. Change-Id: I214a6ae2da0c21fd733ea884bccb5e77fc554615 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquicktableview.cpp17
-rw-r--r--src/quick/items/qquicktableview_p_p.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 9e795f3c8c..ae1daccb39 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -616,6 +616,7 @@ void QQuickTableViewPrivate::updateContentWidth()
Q_Q(QQuickTableView);
if (syncHorizontally) {
+ QBoolBlocker fixupGuard(inUpdateContentSize, true);
q->QQuickFlickable::setContentWidth(syncView->contentWidth());
return;
}
@@ -632,6 +633,8 @@ void QQuickTableViewPrivate::updateContentWidth()
const qreal remainingSpacing = columnsRemaining * cellSpacing.width();
const qreal estimatedRemainingWidth = remainingColumnWidths + remainingSpacing;
const qreal estimatedWidth = loadedTableOuterRect.right() + estimatedRemainingWidth;
+
+ QBoolBlocker fixupGuard(inUpdateContentSize, true);
q->QQuickFlickable::setContentWidth(estimatedWidth);
}
@@ -640,6 +643,7 @@ void QQuickTableViewPrivate::updateContentHeight()
Q_Q(QQuickTableView);
if (syncVertically) {
+ QBoolBlocker fixupGuard(inUpdateContentSize, true);
q->QQuickFlickable::setContentHeight(syncView->contentHeight());
return;
}
@@ -656,6 +660,8 @@ void QQuickTableViewPrivate::updateContentHeight()
const qreal remainingSpacing = rowsRemaining * cellSpacing.height();
const qreal estimatedRemainingHeight = remainingRowHeights + remainingSpacing;
const qreal estimatedHeight = loadedTableOuterRect.bottom() + estimatedRemainingHeight;
+
+ QBoolBlocker fixupGuard(inUpdateContentSize, true);
q->QQuickFlickable::setContentHeight(estimatedHeight);
}
@@ -1924,8 +1930,17 @@ bool QQuickTableViewPrivate::updateTable()
void QQuickTableViewPrivate::fixup(QQuickFlickablePrivate::AxisData &data, qreal minExtent, qreal maxExtent)
{
- if (scheduledRebuildOptions || rebuildState != RebuildState::Done)
+ if (inUpdateContentSize) {
+ // We update the content size dynamically as we load and unload edges.
+ // Unfortunately, this also triggers a call to this function. The base
+ // implementation will do things like start a momentum animation or move
+ // the content view somewhere else, which causes glitches. This can
+ // especially happen if flicking on one of the syncView children, which triggers
+ // an update to our content size. In that case, the base implementation don't know
+ // that the view is being indirectly dragged, and will therefore do strange things as
+ // it tries to 'fixup' the geometry. So we use a guard to prevent this from happening.
return;
+ }
QQuickFlickablePrivate::fixup(data, minExtent, maxExtent);
}
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h
index 7f2aee9105..e2a413db2c 100644
--- a/src/quick/items/qquicktableview_p_p.h
+++ b/src/quick/items/qquicktableview_p_p.h
@@ -272,6 +272,7 @@ public:
bool syncHorizontally = false;
bool inSetLocalViewportPos = false;
bool inSyncViewportPosRecursive = false;
+ bool inUpdateContentSize = false;
QJSValue rowHeightProvider;
QJSValue columnWidthProvider;