diff options
Diffstat (limited to 'pokemodr/PokemodTreeModel.cpp')
| -rw-r--r-- | pokemodr/PokemodTreeModel.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/pokemodr/PokemodTreeModel.cpp b/pokemodr/PokemodTreeModel.cpp index fbb0c707..2fa0467a 100644 --- a/pokemodr/PokemodTreeModel.cpp +++ b/pokemodr/PokemodTreeModel.cpp @@ -26,18 +26,18 @@ #include <QMimeData> #include <QStringList> -PokemodTreeModel::PokemodTreeModel(QObject* parent) : +Pokemodr::PokemodTreeModel::PokemodTreeModel(QObject* parent) : QAbstractItemModel(parent), m_root(new RootModel) { } -PokemodTreeModel::~PokemodTreeModel() +Pokemodr::PokemodTreeModel::~PokemodTreeModel() { delete m_root; } -QVariant PokemodTreeModel::data(const QModelIndex& index, int role) const +QVariant Pokemodr::PokemodTreeModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) return QVariant(); @@ -45,12 +45,12 @@ QVariant PokemodTreeModel::data(const QModelIndex& index, int role) const return object->data(role); } -QVariant PokemodTreeModel::headerData(int /*section*/, Qt::Orientation /*orientation*/, int /*role = Qt::DisplayRole*/) const +QVariant Pokemodr::PokemodTreeModel::headerData(int /*section*/, Qt::Orientation /*orientation*/, int /*role = Qt::DisplayRole*/) const { return QVariant(); } -QModelIndex PokemodTreeModel::index(int row, int column, const QModelIndex& parent) const +QModelIndex Pokemodr::PokemodTreeModel::index(int row, int column, const QModelIndex& parent) const { if ((row < -1) || (column < -1)) return QModelIndex(); @@ -63,7 +63,7 @@ QModelIndex PokemodTreeModel::index(int row, int column, const QModelIndex& pare return createIndex(row, 0, object); } -QModelIndex PokemodTreeModel::parent(const QModelIndex& index) const +QModelIndex Pokemodr::PokemodTreeModel::parent(const QModelIndex& index) const { if (!index.isValid()) return QModelIndex(); @@ -73,18 +73,18 @@ QModelIndex PokemodTreeModel::parent(const QModelIndex& index) const return createIndex(parent->indexNumber(), 0, parent); } -int PokemodTreeModel::rowCount(const QModelIndex& parent) const +int Pokemodr::PokemodTreeModel::rowCount(const QModelIndex& parent) const { BaseModel* object = getItem(parent); return object->rowCount(); } -int PokemodTreeModel::columnCount(const QModelIndex& /*parent*/) const +int Pokemodr::PokemodTreeModel::columnCount(const QModelIndex& /*parent*/) const { return 1; } -Qt::ItemFlags PokemodTreeModel::flags(const QModelIndex& index) const +Qt::ItemFlags Pokemodr::PokemodTreeModel::flags(const QModelIndex& index) const { if (!index.isValid()) return 0; @@ -92,7 +92,7 @@ Qt::ItemFlags PokemodTreeModel::flags(const QModelIndex& index) const return object->flags(); } -bool PokemodTreeModel::setData(const QModelIndex& index, const QVariant& value, int role) +bool Pokemodr::PokemodTreeModel::setData(const QModelIndex& index, const QVariant& value, int role) { if (!index.isValid()) return false; @@ -104,7 +104,7 @@ bool PokemodTreeModel::setData(const QModelIndex& index, const QVariant& value, return success; } -BaseModel* PokemodTreeModel::getItem(const QModelIndex& index) const +Pokemodr::BaseModel* Pokemodr::PokemodTreeModel::getItem(const QModelIndex& index) const { if (index.isValid()) { @@ -115,44 +115,44 @@ BaseModel* PokemodTreeModel::getItem(const QModelIndex& index) const return m_root; } -QStringList PokemodTreeModel::mimeTypes() const +QStringList Pokemodr::PokemodTreeModel::mimeTypes() const { return QStringList() << "application/x-pokemod+xml"; } -QMimeData* PokemodTreeModel::mimeData(const QModelIndexList& indexes) const +QMimeData* Pokemodr::PokemodTreeModel::mimeData(const QModelIndexList& indexes) const { QMimeData *mimeData = new QMimeData(); if ((indexes.size() == 1) && indexes[0].isValid()) { QDomDocument xml; - xml.setContent(data(indexes[0], BaseModel::XmlRole).toString()); + xml.setContent(data(indexes[0], Pokemodr::BaseModel::XmlRole).toString()); mimeData->setData("application/x-pokemod+xml", xml.toByteArray()); } return mimeData; } -bool PokemodTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int /*row*/, int /*column*/, const QModelIndex& parent) +bool Pokemodr::PokemodTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int /*row*/, int /*column*/, const QModelIndex& parent) { if (action == Qt::IgnoreAction) return true; if (!data->hasFormat("application/x-pokemod+xml")) return false; if (parent.isValid()) - return setData(parent, data->data("application/x-pokemod+xml"), BaseModel::XmlRole); + return setData(parent, data->data("application/x-pokemod+xml"), Pokemodr::BaseModel::XmlRole); emit(layoutAboutToBeChanged()); - bool success = m_root->setData(data->data("application/x-pokemod+xml"), BaseModel::XmlRole); + bool success = m_root->setData(data->data("application/x-pokemod+xml"), Pokemodr::BaseModel::XmlRole); emit(layoutChanged()); return success; } -void PokemodTreeModel::addPokemod(Pokemod* pokemod) +void Pokemodr::PokemodTreeModel::addPokemod(Pokemod::Pokemod* pokemod) { m_root->addPokemod(pokemod); emit(reset()); } -void PokemodTreeModel::deletePokemod(const Pokemod* pokemod) +void Pokemodr::PokemodTreeModel::deletePokemod(const Pokemod::Pokemod* pokemod) { m_root->deletePokemod(pokemod); emit(reset()); |
