summaryrefslogtreecommitdiffstats
path: root/pokemodr/models/RootModel.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-28 14:22:19 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-28 14:22:19 +0000
commit807d2b93bf41682ec1093598f30abe74866e5994 (patch)
treec7f12110361e6c44402af0a894dd116b99e68c94 /pokemodr/models/RootModel.cpp
parent0fa52c1f61c457c9b68bec53bcce3af858e5eb44 (diff)
downloadsigen-807d2b93bf41682ec1093598f30abe74866e5994.tar.gz
sigen-807d2b93bf41682ec1093598f30abe74866e5994.tar.xz
sigen-807d2b93bf41682ec1093598f30abe74866e5994.zip
[FIX] De-inlined some methods
[FIX] More mounds checking [FIX] RootModel inherits GroupModel [FIX] Tree displays correctly (though segfaults on some expansion) [FIX] Some more header cleanup git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@113 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/models/RootModel.cpp')
-rw-r--r--pokemodr/models/RootModel.cpp65
1 files changed, 7 insertions, 58 deletions
diff --git a/pokemodr/models/RootModel.cpp b/pokemodr/models/RootModel.cpp
index 7413ece5..851286d1 100644
--- a/pokemodr/models/RootModel.cpp
+++ b/pokemodr/models/RootModel.cpp
@@ -28,67 +28,31 @@
#include <QFile>
RootModel::RootModel(const QList<QVariant>& pokemods) :
- BaseModel(NULL, NULL, "")
+ GroupModel(NULL, NULL)
{
QFile fin("full.pmod");
fin.open(QIODevice::ReadOnly);
QDomDocument xml;
xml.setContent(&fin);
fin.close();
- m_pokemods.append(new PokemodModel(this, new Pokemod(xml.documentElement())));
+ m_objects.append(new PokemodModel(this, new Pokemod(xml.documentElement())));
+ m_objects.append(new PokemodModel(this, new Pokemod(xml.documentElement())));
// TODO: make sub models from data
}
RootModel::~RootModel()
{
- foreach (PokemodModel* model, m_pokemods)
- delete model;
-}
-
-QVariant RootModel::data(const int /*role = Qt::DisplayRole*/) const
-{
- return QVariant();
-}
-
-int RootModel::rowCount() const
-{
- return m_pokemods.size();
-}
-
-Qt::ItemFlags RootModel::flags() const
-{
- return Qt::ItemIsDropEnabled | Qt::ItemIsEnabled;
-}
-
-bool RootModel::setData(const QVariant& /*value*/, const int /*role*/)
-{
- return false;
-}
-
-BaseModel* RootModel::childItem(const int row)
-{
- return m_pokemods[row];
}
int RootModel::indexNumber() const
{
- return 0;
-}
-
-bool RootModel::canInsertRows() const
-{
- return true;
+ return -1;
}
bool RootModel::insertRows(const int rows)
{
for (int i = 0; i < rows; ++i)
- m_pokemods.append(new PokemodModel(this, new Pokemod()));
- return true;
-}
-
-bool RootModel::canRemoveRows() const
-{
+ m_objects.append(new PokemodModel(this, new Pokemod()));
return true;
}
@@ -96,23 +60,8 @@ bool RootModel::removeRows(const int position, const int rows)
{
for (int i = 0; i < rows; ++i)
{
- delete m_pokemods[position];
- m_pokemods.removeAt(position);
+ delete m_objects[position];
+ m_objects.removeAt(position);
}
return true;
}
-
-Qt::DropActions RootModel::supportedDragActions()
-{
- return 0;
-}
-
-Qt::DropActions RootModel::supportedDropActions()
-{
- return Qt::CopyAction | Qt::MoveAction;
-}
-
-QString RootModel::type() const
-{
- return "";
-}