From f444f5a45e9325644a360f656176d47d7f540f52 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 25 Apr 2008 22:25:05 +0000 Subject: [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 --- pokemodr/models/RootModel.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'pokemodr/models/RootModel.cpp') 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 +// Model includes +#include "PokemodModel.h" + // Header include #include "RootModel.h" RootModel::RootModel(const QList& 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 ""; +} -- cgit