From e95495142321fdf5c3a50a7ff6322a711be68555 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 31 Dec 2017 12:38:33 +0100 Subject: Fix QAbstractItemModel::beginRemoveRows in examples QAbstractItemModel::beginRemoveRows() must not take a negative value for first or last. It will assert so we should make sure the examples are correct. The assertion was added in 00c09e752ff7e482e1308e0e34721dc979204595 Change-Id: I539175c0597ed6f0ae76b7493fd3dca40638714e Reviewed-by: Giuseppe D'Angelo Reviewed-by: Martin Smith --- examples/widgets/itemviews/fetchmore/filelistmodel.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'examples/widgets/itemviews/fetchmore') diff --git a/examples/widgets/itemviews/fetchmore/filelistmodel.cpp b/examples/widgets/itemviews/fetchmore/filelistmodel.cpp index cd21712e04..086d45eca3 100644 --- a/examples/widgets/itemviews/fetchmore/filelistmodel.cpp +++ b/examples/widgets/itemviews/fetchmore/filelistmodel.cpp @@ -103,6 +103,9 @@ void FileListModel::fetchMore(const QModelIndex & /* index */) int remainder = fileList.size() - fileCount; int itemsToFetch = qMin(100, remainder); + if (itemsToFetch <= 0) + return; + beginInsertRows(QModelIndex(), fileCount, fileCount+itemsToFetch-1); fileCount += itemsToFetch; -- cgit v1.2.3