You should be using QPersistentModelIndex instead of QModelIndex.