summaryrefslogtreecommitdiffstats
path: root/pokemodr/models/RootModel.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-25 22:25:05 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-25 22:25:05 +0000
commitf444f5a45e9325644a360f656176d47d7f540f52 (patch)
tree9206d27c3ed1d0bcf6fe70560f7b22fe98f4d880 /pokemodr/models/RootModel.cpp
parente13073c4357b2b85eba8a015f38e9f69f4d1799c (diff)
downloadsigen-f444f5a45e9325644a360f656176d47d7f540f52.tar.gz
sigen-f444f5a45e9325644a360f656176d47d7f540f52.tar.xz
sigen-f444f5a45e9325644a360f656176d47d7f540f52.zip
[FIX] Matrix edge case when size is (0,0)
[FIX] TypeChart mess fixed [FIX] Test code for RootModel added git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@110 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/models/RootModel.cpp')
-rw-r--r--pokemodr/models/RootModel.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/pokemodr/models/RootModel.cpp b/pokemodr/models/RootModel.cpp
index ad5bd7b7..2e04b3d7 100644
--- a/pokemodr/models/RootModel.cpp
+++ b/pokemodr/models/RootModel.cpp
@@ -18,19 +18,33 @@
// Pokemod includes
#include <Pokemod.h>
+// Model includes
+#include "PokemodModel.h"
+
// Header include
#include "RootModel.h"
RootModel::RootModel(const QList<QVariant>& pokemods) :
BaseModel(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())));
// TODO: make sub models from data
}
RootModel::~RootModel()
{
- foreach (PokemodModel* pokemod, m_pokemods)
- delete pokemod;
+ foreach (PokemodModel* model, m_pokemods)
+ delete model;
+}
+
+QVariant RootModel::data(const int /*role = Qt::DisplayRole*/) const
+{
+ return QVariant();
}
int RootModel::rowCount() const
@@ -43,7 +57,7 @@ Qt::ItemFlags RootModel::flags() const
return Qt::ItemIsDropEnabled | Qt::ItemIsEnabled;
}
-bool RootModel::setData(const QVariant& value, const int role)
+bool RootModel::setData(const QVariant& /*value*/, const int /*role*/)
{
return false;
}
@@ -67,6 +81,7 @@ 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
@@ -83,3 +98,18 @@ bool RootModel::removeRows(const int position, const int rows)
}
return true;
}
+
+Qt::DropActions RootModel::supportedDragActions()
+{
+ return 0;
+}
+
+Qt::DropActions RootModel::supportedDropActions()
+{
+ return Qt::CopyAction | Qt::MoveAction;
+}
+
+QString RootModel::type() const
+{
+ return "";
+}