forked from qt-creator/qt-creator
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 <miikka.heikkinen@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -179,15 +179,16 @@ bool CollectionDetailsModel::setHeaderData(int section,
|
|||||||
return headerChanged;
|
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)
|
if (count < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
row = qBound(0, row, rowCount());
|
row = qBound(0, row, rowCount());
|
||||||
beginInsertRows(parent, row, row + count);
|
|
||||||
|
beginResetModel();
|
||||||
m_currentCollection.insertEmptyElements(row, count);
|
m_currentCollection.insertEmptyElements(row, count);
|
||||||
endInsertRows();
|
endResetModel();
|
||||||
|
|
||||||
selectRow(row);
|
selectRow(row);
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user