I have a subclass of QAbstractItemModel which uses lazy population. Generally I know whether any given item has children before it is actually populated, but sometimes this changes even though the item is not yet populated.

As long as a parent item is populated, I can just use QAbstractItemModel::beginInsertRows()/QAbstractItemModel::endInsertRows() or QAbstractItemModel::beginRemoveRows()/QAbstractItemModel::endRemoveRows() and, with proper adjustments in the various virtual functions, everything works fine. But when the parent item is not yet populated — QAbstractItemModel::canFetchMore() and QAbstractItemModel::hasChildren return the same value, either true or false, and QAbstractItemModel::rowCount() returns 0 — reversing the return values of QAbstractItemModel::canFetchMore() and QAbstractItemModel::hasChildren() doesn’t add or remove the expansion icon in a connected QTreeView without doing something else (which makes sense, since nothing has happened in the model that would send a signal to tell the view to call QAbstractItemModel::hasChildren() again for the item in question).

What do I do in a QAbstractItemModel subclass to tell the connected views that they need to recheck the value of QAbstractItemModel::hasChildren() for a particular item, even though no children have been added or removed, since it is not yet populated?