From a9975096cc39198c07564bd2c12b5da6e0fc2875 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 29 Apr 2008 07:55:55 +0000 Subject: [FIX] QStringList needed in some of the pokemod headers [ADD] Rest of the model classes [FIX] Small bugfixes within the models git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@117 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- pokemodr/models/CoinListObjectModel.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'pokemodr/models/CoinListObjectModel.cpp') diff --git a/pokemodr/models/CoinListObjectModel.cpp b/pokemodr/models/CoinListObjectModel.cpp index ffe860c1..7b520a2f 100644 --- a/pokemodr/models/CoinListObjectModel.cpp +++ b/pokemodr/models/CoinListObjectModel.cpp @@ -28,7 +28,6 @@ #include "../../pokemod/Species.h" // Qt includes -#include #include CoinListObjectModel::CoinListObjectModel(BaseModel* parent, CoinListObject* object) : @@ -46,9 +45,17 @@ QVariant CoinListObjectModel::data(int role) const { CoinListObject* object = static_cast(m_object); if (object->type() == CoinListObject::Item) - return static_cast(m_object->pokemod())->item(object->object())->name(); + { + const Item* item = static_cast(m_object->pokemod())->itemById(object->object()); + if (item) + return item->name(); + } else if (object->type() == CoinListObject::Species) - return static_cast(m_object->pokemod())->species(object->object())->name(); + { + const Species* species = static_cast(m_object->pokemod())->speciesById(object->object()); + if (species) + return species->name(); + } } else if (role == BaseModel::XmlRole) { -- cgit