summaryrefslogtreecommitdiffstats
path: root/sigmodr/tree/SigmodrTreeModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/tree/SigmodrTreeModel.cpp')
-rw-r--r--sigmodr/tree/SigmodrTreeModel.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/sigmodr/tree/SigmodrTreeModel.cpp b/sigmodr/tree/SigmodrTreeModel.cpp
index 6dd42fb0..dcfd04f3 100644
--- a/sigmodr/tree/SigmodrTreeModel.cpp
+++ b/sigmodr/tree/SigmodrTreeModel.cpp
@@ -37,7 +37,7 @@ SigmodrTreeModel::SigmodrTreeModel(QObject* parent) :
QAbstractItemModel(parent),
m_root(new RootModel)
{
- connect(m_root, SIGNAL(rowsChanged(QList<int>)), this, SLOT(rowsChanged(QList<int>)));
+ connect(m_root, SIGNAL(rowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)), this, SLOT(rowsChanged(QList<int>, Sigmodr::Tree::BaseModel::Change)));
}
SigmodrTreeModel::~SigmodrTreeModel()
@@ -186,13 +186,22 @@ const Game* SigmodrTreeModel::findGame(const QModelIndex& index) const
return qobject_cast<const Game*>(getItem(curIndex)->object());
}
-void SigmodrTreeModel::rowsChanged(const QList<int>& rows)
+void SigmodrTreeModel::rowsChanged(const QList<int>& rows, const BaseModel::Change change)
{
QModelIndex curIndex;
foreach (int row, rows)
curIndex = index(row, 0, curIndex);
if (curIndex.isValid())
{
+ switch (change)
+ {
+ case BaseModel::Addition:
+ insertRow(rows.back(), parent(curIndex));
+ break;
+ case BaseModel::Removal:
+ removeRow(rows.back(), parent(curIndex));
+ break;
+ }
emit(dataChanged(curIndex, curIndex));
emit(dirty(findGame(curIndex), true));
}