summaryrefslogtreecommitdiffstats
path: root/pokemodr/PokemodTreeModel.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-25 21:17:56 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-25 21:17:56 +0000
commit7e3bf1853184f96eb5be47dd78ebe21fdc170a01 (patch)
tree7c937aa87fa165fc62bb49d71983e1512f2371c2 /pokemodr/PokemodTreeModel.cpp
parentdec252e25fc63fe1bb321dd87772181fc76e998f (diff)
downloadsigen-7e3bf1853184f96eb5be47dd78ebe21fdc170a01.tar.gz
sigen-7e3bf1853184f96eb5be47dd78ebe21fdc170a01.tar.xz
sigen-7e3bf1853184f96eb5be47dd78ebe21fdc170a01.zip
[ADD] More documentation
[FIX] Cleaned out some code from the models [FIX] Matrix should now work a lot better now [FIX] Opening/Saving/Closing PokéMods should be much cleaner now [FIX] currentPokemod code is now in the tree class git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@173 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/PokemodTreeModel.cpp')
-rw-r--r--pokemodr/PokemodTreeModel.cpp31
1 files changed, 3 insertions, 28 deletions
diff --git a/pokemodr/PokemodTreeModel.cpp b/pokemodr/PokemodTreeModel.cpp
index fb8aa4f5..8b71a422 100644
--- a/pokemodr/PokemodTreeModel.cpp
+++ b/pokemodr/PokemodTreeModel.cpp
@@ -62,8 +62,7 @@ QModelIndex PokemodTreeModel::parent(const QModelIndex& index) const
{
if (!index.isValid())
return QModelIndex();
- BaseModel* object = static_cast<BaseModel*>(index.internalPointer());
- BaseModel* parent = object->parent();
+ BaseModel* parent = static_cast<BaseModel*>(index.internalPointer())->parent();
if (!parent || (parent == m_root))
return QModelIndex();
return createIndex(parent->indexNumber(), 0, parent);
@@ -100,28 +99,6 @@ bool PokemodTreeModel::setData(const QModelIndex& index, const QVariant& value,
return success;
}
-bool PokemodTreeModel::insertRows(int /*position*/, int rows, const QModelIndex& parent)
-{
- BaseModel* object = getItem(parent);
- if (!object->canInsertRows())
- return false;
- emit(layoutAboutToBeChanged());
- bool success = object->insertRows(rows);
- emit(layoutChanged());
- return success;
-}
-
-bool PokemodTreeModel::removeRows(int position, int rows, const QModelIndex& parent)
-{
- BaseModel* object = getItem(parent);
- if (!object->canRemoveRows())
- return false;
- emit(layoutAboutToBeChanged());
- bool success = object->removeRows(position, rows);
- emit(layoutChanged());
- return success;
-}
-
BaseModel* PokemodTreeModel::getItem(const QModelIndex& index) const
{
if (index.isValid())
@@ -166,14 +143,12 @@ bool PokemodTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action
void PokemodTreeModel::addPokemod(Pokemod* pokemod)
{
- emit(layoutAboutToBeChanged());
m_root->addPokemod(pokemod);
- emit(layoutChanged());
+ emit(reset());
}
void PokemodTreeModel::deletePokemod(const Pokemod* pokemod)
{
- emit(layoutAboutToBeChanged());
m_root->deletePokemod(pokemod);
- emit(layoutChanged());
+ emit(reset());
}