I don't think so. The view does react correctly, removing the rows that have been deleted.
This is the relevant code, element_deleted is connected to QObject::destroyed
{
if ( !obj->parent() )
return createIndex(0, 0, obj);
return createIndex(obj->parent()->children().indexOf(obj), 0, obj);
}
void ProjectModel
::element_deleted(QObject* obj
) {
auto parent_index = index_from_qobject(parent);
int row = parent->children().indexOf(obj);
beginRemoveRows(parent_index, row, row);
endRemoveRows();
}
QModelIndex ProjectModel::index_from_qobject(QObject* obj) const
{
if ( !obj->parent() )
return createIndex(0, 0, obj);
return createIndex(obj->parent()->children().indexOf(obj), 0, obj);
}
void ProjectModel::element_deleted(QObject* obj)
{
QObject* parent = obj->parent();
auto parent_index = index_from_qobject(parent);
int row = parent->children().indexOf(obj);
beginRemoveRows(parent_index, row, row);
endRemoveRows();
}
To copy to clipboard, switch view to plain text mode
Bookmarks