summaryrefslogtreecommitdiffstats
path: root/sigmodr/models/MapWildListModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/models/MapWildListModel.cpp')
-rw-r--r--sigmodr/models/MapWildListModel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/sigmodr/models/MapWildListModel.cpp b/sigmodr/models/MapWildListModel.cpp
index 37c4cc33..7204e394 100644
--- a/sigmodr/models/MapWildListModel.cpp
+++ b/sigmodr/models/MapWildListModel.cpp
@@ -20,6 +20,7 @@
// Model includes
#include "MapWildListEncounterModel.h"
+#include "GroupModel.h"
// Sigmodr includes
#include "../MapWildListUI.h"
@@ -79,23 +80,24 @@ void Sigmodr::MapWildListModel::addObject(Sigmod::Object* object)
if (!object)
object = qobject_cast<Sigmod::MapWildList*>(m_object)->newEncounter();
if (object->className() == "MapWildListEncounter")
- m_objects.append(new MapWildListEncounterModel(this, qobject_cast<Sigmod::MapWildListEncounter*>(object)));
+ addChild(new MapWildListEncounterModel(this, qobject_cast<Sigmod::MapWildListEncounter*>(object)));
}
void Sigmodr::MapWildListModel::deleteObject(BaseModel* model)
{
- const int index = m_objects.indexOf(model);
+ const int index = find(model);
if (0 <= index)
{
qobject_cast<Sigmod::MapWildList*>(m_object)->deleteEncounter(index);
m_objects[index]->deleteLater();
m_objects.removeAt(index);
+ childRowChanged(index);
}
}
void Sigmodr::MapWildListModel::deleteSelf()
{
-// qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
+ qobject_cast<GroupModel*>(m_parent)->deleteObject(this);
}
bool Sigmodr::MapWildListModel::setData(const QVariant& value, int role)
@@ -131,5 +133,5 @@ void Sigmodr::MapWildListModel::setupData()
{
Sigmod::MapWildList* wildList = qobject_cast<Sigmod::MapWildList*>(m_object);
for (int i = 0; i < wildList->encounterCount(); ++i)
- m_objects.append(new MapWildListEncounterModel(this, wildList->encounter(i)));
+ addChild(new MapWildListEncounterModel(this, wildList->encounter(i)));
}