diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2019-10-22 15:30:20 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2019-11-12 14:46:41 +0100 |
commit | 8952800c68743d0c98e3f638a5bafef1e78fa1d9 (patch) | |
tree | 5650a01d792b7d5897c4ce1622df813827be0d9f /src/quick/items/qquicktableview_p_p.h | |
parent | 06267f90a2ec6e67c754f1b9fd2a516c37fd784e (diff) |
QQuickTableView::forceLayout(): rebuild table if the size of the model has changed
An assert will trigger if forceLayout() is called while the model is
being reset. The reason is that the forceLayout() schedules a relayout
which assumes that the size of the model hasn't changed. But while
layouting, it will try to fetch data from the model according to the
old size, which will trigger an assert.
This patch will add an extra path to forceLayout() that checks if the
size of the model has changed, and if so, schedule a complete
rebuild instead of just a relayout.
Fixes: QTBUG-79395
Change-Id: If61658912d9e90c1a5aef9bc28083da20fa6ec76
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview_p_p.h')
-rw-r--r-- | src/quick/items/qquicktableview_p_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h index b66ac66dec..5f53420506 100644 --- a/src/quick/items/qquicktableview_p_p.h +++ b/src/quick/items/qquicktableview_p_p.h @@ -322,7 +322,8 @@ public: qreal sizeHintForColumn(int column); qreal sizeHintForRow(int row); - void calculateTableSize(); + QSize calculateTableSize(); + void updateTableSize(); inline bool isColumnHidden(int column); inline bool isRowHidden(int row); @@ -351,6 +352,7 @@ public: void updateContentWidth(); void updateContentHeight(); void updateAverageEdgeSize(); + RebuildOptions checkForVisibilityChanges(); void forceLayout(); void updateExtents(); |