diff options
Diffstat (limited to 'sigmodr/tree/TreeModel.cpp')
-rw-r--r-- | sigmodr/tree/TreeModel.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sigmodr/tree/TreeModel.cpp b/sigmodr/tree/TreeModel.cpp index c22020d3..3f0884f2 100644 --- a/sigmodr/tree/TreeModel.cpp +++ b/sigmodr/tree/TreeModel.cpp @@ -164,3 +164,24 @@ void TreeModel::addGame(Game* game) m_root->addGame(game); endInsertRows(); } + +void TreeModel::deleteGame(const Game* game) +{ + for (int i = 0; i < m_root->childCount(); ++i) + { + if (m_root->childAt(i)->game() == game) + { + beginRemoveRows(index(-1, -1, QModelIndex()), i, i); + m_root->removeChild(i); + endRemoveRows(); + break; + } + } +} + +const Game* TreeModel::findGame(const QModelIndex& index) const +{ + if (!index.isValid()) + return NULL; + return static_cast<TreeItem*>(index.internalPointer())->game(); +} |