aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp
diff options
context:
space:
mode:
authorMohammadHossein Qanbari <mohammad.qanbari@qt.io>2024-07-10 10:42:35 +0200
committerMohammadHossein Qanbari <mohammad.qanbari@qt.io>2024-07-12 20:59:51 +0200
commit33b5ba74ed99a1d19dcd757f941f7909f9d5c414 (patch)
tree2105cd76a48db97163cd65b9fae3a6d2b0bab6f9 /examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp
parentf4605fbf00d8dc52b4d165946fd0727b2d0d7a38 (diff)
Spreadsheets Example: Fix bug in inserting a new row
When inserting a new row (above or below an existing row), it was causing a crash. There was a forgotten call of the previous() method on the iterator that was supposed to iterate backward. It has been fixed by adding this function call inside the loop. Task-number: QTBUG-125767 Pick-to: 6.8 Change-Id: I6a4436bacb0348c1b6bccd929f715e36d0279754 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Diffstat (limited to 'examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp')
-rw-r--r--examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp b/examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp
index c27b693173..979666e9f3 100644
--- a/examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp
+++ b/examples/quickcontrols/spreadsheets/Spreadsheets/datamodel.cpp
@@ -187,6 +187,7 @@ void DataModel::shiftRows(int from, int count)
QMapIterator i(m_cells);
i.toBack();
while (i.hasPrevious()) {
+ i.previous();
if (i.key().first < from)
break;
SpreadKey key = i.key();