summaryrefslogtreecommitdiffstats
path: root/examples/qtconcurrent/map/main.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2024-04-15 17:00:19 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2024-04-17 04:38:33 +0200
commit960867566a75931c338f67cfe429c0756f41ad89 (patch)
treeff14f3e705aa7df307fc1003f9d35b62db48bc93 /examples/qtconcurrent/map/main.cpp
parent62d02c1d509780eca7d3a4c35ac64a0d475d0fe7 (diff)
QTableView: fix infinite loop when resizing rows/columns on model reset
When a slot is connected to the modelReset signal before the model is set on the view, then such a slot might try to resize the columns or rows to fit the contents before the view had a chance to perform layout work. In that case, the while-loop that calculated the size hint of a rows (or column) by checking the size hint of each cell might not exit, as cached information about visual indexes would be invalid. To prevent this, don't loop over the cells if the actual last row/column of the model (after the reset) is less than the first (cached) visible row/column. Also, make sure we increase the counter for number of rows/columns processed with each iteration. Add a test (that loops infinitely without the fix, resulting in the test being killed by the framework), and make the 'actual' variables constant for clarity. Fixes: QTBUG-124301 Pick-to: 6.7 Change-Id: I0adb2f1e8a1e78760ef7c19e9686c9572eca8be6 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'examples/qtconcurrent/map/main.cpp')
0 files changed, 0 insertions, 0 deletions