From 08d7dcc46b302eecf6379fc7c26c2c6566e4e135 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Thu, 14 Dec 2023 16:55:06 +0200 Subject: [PATCH] QmlDesigner: Fix the bug for adding rows to a Collection After adding a row to the model, TableView reads the whole model except one cell. It also ignores all the further notifications for that cell even if we notify it explicitly. By notifying a model reset, this will be solved. Fixes: QDS-11248 Change-Id: I92cc7be5f82bc9acd2f9695f6f6a306ef003b78c Reviewed-by: Miikka Heikkinen Reviewed-by: Qt CI Patch Build Bot --- .../components/collectioneditor/collectiondetailsmodel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp b/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp index 533c2d72b6c..2279b60d130 100644 --- a/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp +++ b/src/plugins/qmldesigner/components/collectioneditor/collectiondetailsmodel.cpp @@ -179,15 +179,16 @@ bool CollectionDetailsModel::setHeaderData(int section, return headerChanged; } -bool CollectionDetailsModel::insertRows(int row, int count, const QModelIndex &parent) +bool CollectionDetailsModel::insertRows(int row, int count, [[maybe_unused]] const QModelIndex &parent) { if (count < 1) return false; row = qBound(0, row, rowCount()); - beginInsertRows(parent, row, row + count); + + beginResetModel(); m_currentCollection.insertEmptyElements(row, count); - endInsertRows(); + endResetModel(); selectRow(row); return true;