diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-09-15 21:43:21 +0000 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-09-15 21:43:21 +0000 |
commit | 0f0dbfb0395810c1c205a1dc10cf1f226669fd00 (patch) | |
tree | 20cea50f0c9bdfede9be29b71bbac15c18ec5230 /sigmodr/models | |
parent | de1e4dc34ab030b468f5ce7cf567bacc5d749423 (diff) | |
download | sigen-0f0dbfb0395810c1c205a1dc10cf1f226669fd00.tar.gz sigen-0f0dbfb0395810c1c205a1dc10cf1f226669fd00.tar.xz sigen-0f0dbfb0395810c1c205a1dc10cf1f226669fd00.zip |
[FIX] Copy and pasting in the tree works better now
[FIX] Drag and dropped touched up
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@264 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigmodr/models')
79 files changed, 324 insertions, 32 deletions
diff --git a/sigmodr/models/AbilityGroupModel.cpp b/sigmodr/models/AbilityGroupModel.cpp index adb5b19f..86805209 100644 --- a/sigmodr/models/AbilityGroupModel.cpp +++ b/sigmodr/models/AbilityGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::AbilityGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::AbilityGroupModel::types() const +{ + return "Ability"; +} + void Sigmodr::AbilityGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/AbilityGroupModel.h b/sigmodr/models/AbilityGroupModel.h index eb55985c..73bbd6df 100644 --- a/sigmodr/models/AbilityGroupModel.h +++ b/sigmodr/models/AbilityGroupModel.h @@ -39,6 +39,8 @@ class AbilityGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/AuthorGroupModel.cpp b/sigmodr/models/AuthorGroupModel.cpp index 8e2c635a..b33103b9 100644 --- a/sigmodr/models/AuthorGroupModel.cpp +++ b/sigmodr/models/AuthorGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::AuthorGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::AuthorGroupModel::types() const +{ + return "Author"; +} + void Sigmodr::AuthorGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/AuthorGroupModel.h b/sigmodr/models/AuthorGroupModel.h index 6894f477..c1cd5777 100644 --- a/sigmodr/models/AuthorGroupModel.h +++ b/sigmodr/models/AuthorGroupModel.h @@ -39,6 +39,8 @@ class AuthorGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/BadgeGroupModel.cpp b/sigmodr/models/BadgeGroupModel.cpp index 5a018abc..86dbd8bc 100644 --- a/sigmodr/models/BadgeGroupModel.cpp +++ b/sigmodr/models/BadgeGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::BadgeGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::BadgeGroupModel::types() const +{ + return "Badge"; +} + void Sigmodr::BadgeGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/BadgeGroupModel.h b/sigmodr/models/BadgeGroupModel.h index 908ecd73..1763260f 100644 --- a/sigmodr/models/BadgeGroupModel.h +++ b/sigmodr/models/BadgeGroupModel.h @@ -39,6 +39,8 @@ class BadgeGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/BaseModel.cpp b/sigmodr/models/BaseModel.cpp index f64baf35..8258fb0f 100644 --- a/sigmodr/models/BaseModel.cpp +++ b/sigmodr/models/BaseModel.cpp @@ -36,6 +36,8 @@ QVariant Sigmodr::BaseModel::data(int role) const { if (role == Sigmodr::BaseModel::TypeRole) return type(); + else if (role == Sigmodr::BaseModel::DropAcceptRole) + return types(); return QVariant(); } diff --git a/sigmodr/models/BaseModel.h b/sigmodr/models/BaseModel.h index dfa1c260..9ca22e38 100644 --- a/sigmodr/models/BaseModel.h +++ b/sigmodr/models/BaseModel.h @@ -54,13 +54,15 @@ class BaseModel : public QObject virtual Qt::DropActions supportedDropActions() const = 0; virtual QString type() const; + virtual QString types() const = 0; const Sigmod::Object* object() const; static const int TypeRole = Qt::UserRole; - static const int XmlRole = Qt::UserRole + 1; - static const int WidgetRole = Qt::UserRole + 2; - static const int ContextMenuRole = Qt::UserRole + 3; + static const int DropAcceptRole = Qt::UserRole + 1; + static const int XmlRole = Qt::UserRole + 2; + static const int WidgetRole = Qt::UserRole + 3; + static const int ContextMenuRole = Qt::UserRole + 4; signals: void rowChanged(const int row); void rowsChanged(const QList<int>& rows); diff --git a/sigmodr/models/BaseObjectModel.h b/sigmodr/models/BaseObjectModel.h index b67f315f..6bffbaf0 100644 --- a/sigmodr/models/BaseObjectModel.h +++ b/sigmodr/models/BaseObjectModel.h @@ -43,6 +43,7 @@ class BaseObjectModel : public BaseModel Qt::DropActions supportedDropActions() const; QString type() const; + virtual QString types() const = 0; protected: virtual int findChild(BaseModel* /*model*/) const; }; diff --git a/sigmodr/models/CoinListGroupModel.cpp b/sigmodr/models/CoinListGroupModel.cpp index 8921a8aa..d989ee66 100644 --- a/sigmodr/models/CoinListGroupModel.cpp +++ b/sigmodr/models/CoinListGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::CoinListGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::CoinListGroupModel::types() const +{ + return "CoinList"; +} + void Sigmodr::CoinListGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/CoinListGroupModel.h b/sigmodr/models/CoinListGroupModel.h index 68ec213d..5405c498 100644 --- a/sigmodr/models/CoinListGroupModel.h +++ b/sigmodr/models/CoinListGroupModel.h @@ -39,6 +39,8 @@ class CoinListGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/CoinListModel.cpp b/sigmodr/models/CoinListModel.cpp index cac2db61..9452e5b4 100644 --- a/sigmodr/models/CoinListModel.cpp +++ b/sigmodr/models/CoinListModel.cpp @@ -101,6 +101,11 @@ bool Sigmodr::CoinListModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::CoinListModel::types() const +{ + return type().append(";CoinListObject"); +} + void Sigmodr::CoinListModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/CoinListModel.h b/sigmodr/models/CoinListModel.h index 1908afa1..540edc67 100644 --- a/sigmodr/models/CoinListModel.h +++ b/sigmodr/models/CoinListModel.h @@ -40,6 +40,8 @@ class CoinListModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/EggGroupGroupModel.cpp b/sigmodr/models/EggGroupGroupModel.cpp index d309cd0a..9447d4bc 100644 --- a/sigmodr/models/EggGroupGroupModel.cpp +++ b/sigmodr/models/EggGroupGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::EggGroupGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::EggGroupGroupModel::types() const +{ + return "EggGroup"; +} + void Sigmodr::EggGroupGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/EggGroupGroupModel.h b/sigmodr/models/EggGroupGroupModel.h index 39b50e22..a7dce181 100644 --- a/sigmodr/models/EggGroupGroupModel.h +++ b/sigmodr/models/EggGroupGroupModel.h @@ -39,6 +39,8 @@ class EggGroupGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/GlobalScriptGroupModel.cpp b/sigmodr/models/GlobalScriptGroupModel.cpp index 48c02b8e..83d2902d 100644 --- a/sigmodr/models/GlobalScriptGroupModel.cpp +++ b/sigmodr/models/GlobalScriptGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::GlobalScriptGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::GlobalScriptGroupModel::types() const +{ + return "GlobalScript"; +} + void Sigmodr::GlobalScriptGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/GlobalScriptGroupModel.h b/sigmodr/models/GlobalScriptGroupModel.h index d9a8b5ed..1d79b0ee 100644 --- a/sigmodr/models/GlobalScriptGroupModel.h +++ b/sigmodr/models/GlobalScriptGroupModel.h @@ -39,6 +39,8 @@ class GlobalScriptGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/GroupModel.h b/sigmodr/models/GroupModel.h index b579922f..c691566a 100644 --- a/sigmodr/models/GroupModel.h +++ b/sigmodr/models/GroupModel.h @@ -52,6 +52,8 @@ class GroupModel : public BaseModel, public Grouping Qt::DropActions supportedDragActions() const; Qt::DropActions supportedDropActions() const; + + virtual QString types() const = 0; public slots: void addChild(BaseModel* model); diff --git a/sigmodr/models/GroupObjectModel.h b/sigmodr/models/GroupObjectModel.h index 6202dc39..3961d11d 100644 --- a/sigmodr/models/GroupObjectModel.h +++ b/sigmodr/models/GroupObjectModel.h @@ -38,6 +38,8 @@ class GroupObjectModel : public BaseObjectModel, public Grouping virtual bool setData(const QVariant& value, int role = Qt::EditRole) = 0; BaseModel* childItem(const int row); + + virtual QString types() const = 0; public slots: void addChild(BaseModel* model); diff --git a/sigmodr/models/ItemGroupModel.cpp b/sigmodr/models/ItemGroupModel.cpp index c7a0d2a7..e547e641 100644 --- a/sigmodr/models/ItemGroupModel.cpp +++ b/sigmodr/models/ItemGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::ItemGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::ItemGroupModel::types() const +{ + return "Item"; +} + void Sigmodr::ItemGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/ItemGroupModel.h b/sigmodr/models/ItemGroupModel.h index 181fda7e..3a526533 100644 --- a/sigmodr/models/ItemGroupModel.h +++ b/sigmodr/models/ItemGroupModel.h @@ -39,6 +39,8 @@ class ItemGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/ItemTypeGroupModel.cpp b/sigmodr/models/ItemTypeGroupModel.cpp index b43964c6..d9b8a0d0 100644 --- a/sigmodr/models/ItemTypeGroupModel.cpp +++ b/sigmodr/models/ItemTypeGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::ItemTypeGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::ItemTypeGroupModel::types() const +{ + return "ItemType"; +} + void Sigmodr::ItemTypeGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/ItemTypeGroupModel.h b/sigmodr/models/ItemTypeGroupModel.h index c607bddf..28420e73 100644 --- a/sigmodr/models/ItemTypeGroupModel.h +++ b/sigmodr/models/ItemTypeGroupModel.h @@ -39,6 +39,8 @@ class ItemTypeGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MapEffectGroupModel.cpp b/sigmodr/models/MapEffectGroupModel.cpp index ed31414f..b440b22f 100644 --- a/sigmodr/models/MapEffectGroupModel.cpp +++ b/sigmodr/models/MapEffectGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::MapEffectGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MapEffectGroupModel::types() const +{ + return "MapEffect"; +} + void Sigmodr::MapEffectGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/MapEffectGroupModel.h b/sigmodr/models/MapEffectGroupModel.h index 88608370..62c0680e 100644 --- a/sigmodr/models/MapEffectGroupModel.h +++ b/sigmodr/models/MapEffectGroupModel.h @@ -39,6 +39,8 @@ class MapEffectGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MapGroupModel.cpp b/sigmodr/models/MapGroupModel.cpp index 9058bbac..12dbb647 100644 --- a/sigmodr/models/MapGroupModel.cpp +++ b/sigmodr/models/MapGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::MapGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MapGroupModel::types() const +{ + return "Map"; +} + void Sigmodr::MapGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/MapGroupModel.h b/sigmodr/models/MapGroupModel.h index 89836a2b..c6d926a3 100644 --- a/sigmodr/models/MapGroupModel.h +++ b/sigmodr/models/MapGroupModel.h @@ -39,6 +39,8 @@ class MapGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MapModel.cpp b/sigmodr/models/MapModel.cpp index ecd75227..326e388b 100644 --- a/sigmodr/models/MapModel.cpp +++ b/sigmodr/models/MapModel.cpp @@ -88,6 +88,16 @@ bool Sigmodr::MapModel::setData(const QVariant& value, int role) setupData(); return true; } + foreach (BaseModel* model, m_objects) + { + GroupModel* group = qobject_cast<GroupModel*>(model); + if (group) + { + const bool used = group->setData(value, role); + if (used) + return true; + } + } file.close(); } } @@ -95,6 +105,11 @@ bool Sigmodr::MapModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MapModel::types() const +{ + return type().append(";MapEffect;MapTrainer;MapWarp;MapWildList"); +} + void Sigmodr::MapModel::addObject(Sigmod::Object* /*object*/) { } diff --git a/sigmodr/models/MapModel.h b/sigmodr/models/MapModel.h index 2fe4c2d1..9320ac1a 100644 --- a/sigmodr/models/MapModel.h +++ b/sigmodr/models/MapModel.h @@ -40,6 +40,8 @@ class MapModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* /*object = NULL*/); void deleteObject(BaseModel* /*model*/); diff --git a/sigmodr/models/MapTrainerGroupModel.cpp b/sigmodr/models/MapTrainerGroupModel.cpp index 5dec0733..117c41c9 100644 --- a/sigmodr/models/MapTrainerGroupModel.cpp +++ b/sigmodr/models/MapTrainerGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::MapTrainerGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MapTrainerGroupModel::types() const +{ + return "MapTrainer"; +} + void Sigmodr::MapTrainerGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/MapTrainerGroupModel.h b/sigmodr/models/MapTrainerGroupModel.h index f9572033..57b7453c 100644 --- a/sigmodr/models/MapTrainerGroupModel.h +++ b/sigmodr/models/MapTrainerGroupModel.h @@ -39,6 +39,8 @@ class MapTrainerGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MapTrainerModel.cpp b/sigmodr/models/MapTrainerModel.cpp index f4421956..afa1af91 100644 --- a/sigmodr/models/MapTrainerModel.cpp +++ b/sigmodr/models/MapTrainerModel.cpp @@ -73,6 +73,11 @@ QVariant Sigmodr::MapTrainerModel::data(int role) const return Sigmodr::GroupObjectModel::data(role); } +QString Sigmodr::MapTrainerModel::types() const +{ + return type().append(";MapTrainerTeamMember"); +} + void Sigmodr::MapTrainerModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/MapTrainerModel.h b/sigmodr/models/MapTrainerModel.h index 9af22b8d..db344d34 100644 --- a/sigmodr/models/MapTrainerModel.h +++ b/sigmodr/models/MapTrainerModel.h @@ -40,6 +40,8 @@ class MapTrainerModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MapWarpGroupModel.cpp b/sigmodr/models/MapWarpGroupModel.cpp index 775f80e2..1641c804 100644 --- a/sigmodr/models/MapWarpGroupModel.cpp +++ b/sigmodr/models/MapWarpGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::MapWarpGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MapWarpGroupModel::types() const +{ + return "MapWarp"; +} + void Sigmodr::MapWarpGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/MapWarpGroupModel.h b/sigmodr/models/MapWarpGroupModel.h index c6c7ccd3..0af2ce08 100644 --- a/sigmodr/models/MapWarpGroupModel.h +++ b/sigmodr/models/MapWarpGroupModel.h @@ -39,6 +39,8 @@ class MapWarpGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MapWildListGroupModel.cpp b/sigmodr/models/MapWildListGroupModel.cpp index 8598d155..6e35eb4f 100644 --- a/sigmodr/models/MapWildListGroupModel.cpp +++ b/sigmodr/models/MapWildListGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::MapWildListGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MapWildListGroupModel::types() const +{ + return "MapWildList"; +} + void Sigmodr::MapWildListGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/MapWildListGroupModel.h b/sigmodr/models/MapWildListGroupModel.h index ee6e623e..a7c1fa26 100644 --- a/sigmodr/models/MapWildListGroupModel.h +++ b/sigmodr/models/MapWildListGroupModel.h @@ -39,6 +39,8 @@ class MapWildListGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MapWildListModel.cpp b/sigmodr/models/MapWildListModel.cpp index 3f7f8b00..6bf86699 100644 --- a/sigmodr/models/MapWildListModel.cpp +++ b/sigmodr/models/MapWildListModel.cpp @@ -74,32 +74,6 @@ QVariant Sigmodr::MapWildListModel::data(int role) const } return Sigmodr::GroupObjectModel::data(role); } - -void Sigmodr::MapWildListModel::addObject(Sigmod::Object* object) -{ - if (!object) - object = qobject_cast<Sigmod::MapWildList*>(m_object)->newEncounter(); - if (object->className() == "MapWildListEncounter") - addChild(new MapWildListEncounterModel(this, qobject_cast<Sigmod::MapWildListEncounter*>(object))); -} - -void Sigmodr::MapWildListModel::deleteObject(BaseModel* model) -{ - const int index = find(model); - if (0 <= index) - { - qobject_cast<Sigmod::MapWildList*>(m_object)->deleteEncounter(index); - m_objects[index]->deleteLater(); - m_objects.removeAt(index); - childRowChanged(index); - } -} - -void Sigmodr::MapWildListModel::deleteSelf() -{ - qobject_cast<GroupModel*>(m_parent)->deleteObject(this); -} - bool Sigmodr::MapWildListModel::setData(const QVariant& value, int role) { if (role == Sigmodr::BaseModel::XmlRole) @@ -129,6 +103,36 @@ bool Sigmodr::MapWildListModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MapWildListModel::types() const +{ + return type().append(";MapWildListEncounter"); +} + +void Sigmodr::MapWildListModel::addObject(Sigmod::Object* object) +{ + if (!object) + object = qobject_cast<Sigmod::MapWildList*>(m_object)->newEncounter(); + if (object->className() == "MapWildListEncounter") + addChild(new MapWildListEncounterModel(this, qobject_cast<Sigmod::MapWildListEncounter*>(object))); +} + +void Sigmodr::MapWildListModel::deleteObject(BaseModel* model) +{ + const int index = find(model); + if (0 <= index) + { + qobject_cast<Sigmod::MapWildList*>(m_object)->deleteEncounter(index); + m_objects[index]->deleteLater(); + m_objects.removeAt(index); + childRowChanged(index); + } +} + +void Sigmodr::MapWildListModel::deleteSelf() +{ + qobject_cast<GroupModel*>(m_parent)->deleteObject(this); +} + void Sigmodr::MapWildListModel::setupData() { Sigmod::MapWildList* wildList = qobject_cast<Sigmod::MapWildList*>(m_object); diff --git a/sigmodr/models/MapWildListModel.h b/sigmodr/models/MapWildListModel.h index 97fd08f8..e12fd1fd 100644 --- a/sigmodr/models/MapWildListModel.h +++ b/sigmodr/models/MapWildListModel.h @@ -40,6 +40,8 @@ class MapWildListModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/MoveGroupModel.cpp b/sigmodr/models/MoveGroupModel.cpp index b371f573..19675c66 100644 --- a/sigmodr/models/MoveGroupModel.cpp +++ b/sigmodr/models/MoveGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::MoveGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::MoveGroupModel::types() const +{ + return "Move"; +} + void Sigmodr::MoveGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/MoveGroupModel.h b/sigmodr/models/MoveGroupModel.h index 2babfcf8..62280619 100644 --- a/sigmodr/models/MoveGroupModel.h +++ b/sigmodr/models/MoveGroupModel.h @@ -39,6 +39,8 @@ class MoveGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/NatureGroupModel.cpp b/sigmodr/models/NatureGroupModel.cpp index 13e044ab..6a67dafa 100644 --- a/sigmodr/models/NatureGroupModel.cpp +++ b/sigmodr/models/NatureGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::NatureGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::NatureGroupModel::types() const +{ + return "Nature"; +} + void Sigmodr::NatureGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/NatureGroupModel.h b/sigmodr/models/NatureGroupModel.h index 912320ea..6c0c21e5 100644 --- a/sigmodr/models/NatureGroupModel.h +++ b/sigmodr/models/NatureGroupModel.h @@ -39,6 +39,8 @@ class NatureGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/ObjectModel.cpp b/sigmodr/models/ObjectModel.cpp index 585adf7f..198f4aba 100644 --- a/sigmodr/models/ObjectModel.cpp +++ b/sigmodr/models/ObjectModel.cpp @@ -41,3 +41,8 @@ Sigmodr::BaseModel* Sigmodr::ObjectModel::childItem(const int /*row*/) { return NULL; } + +QString Sigmodr::ObjectModel::types() const +{ + return type(); +} diff --git a/sigmodr/models/ObjectModel.h b/sigmodr/models/ObjectModel.h index e8d1081c..cea8912c 100644 --- a/sigmodr/models/ObjectModel.h +++ b/sigmodr/models/ObjectModel.h @@ -37,6 +37,8 @@ class ObjectModel : public BaseObjectModel virtual bool setData(const QVariant& value, int role = Qt::EditRole) = 0; BaseModel* childItem(const int /*row*/); + + QString types() const; public slots: virtual void deleteSelf() = 0; }; diff --git a/sigmodr/models/RootModel.cpp b/sigmodr/models/RootModel.cpp index e433e487..53bc523c 100644 --- a/sigmodr/models/RootModel.cpp +++ b/sigmodr/models/RootModel.cpp @@ -60,6 +60,11 @@ void Sigmodr::RootModel::deleteSigmod(const Sigmod::Sigmod* sigmod) } } +QString Sigmodr::RootModel::types() const +{ + return "Sigmod"; +} + void Sigmodr::RootModel::addObject(Sigmod::Object* /*object*/) { } diff --git a/sigmodr/models/RootModel.h b/sigmodr/models/RootModel.h index c3bf27c0..581319c3 100644 --- a/sigmodr/models/RootModel.h +++ b/sigmodr/models/RootModel.h @@ -39,6 +39,8 @@ class RootModel : public GroupModel void addSigmod(Sigmod::Sigmod* sigmod); void deleteSigmod(const Sigmod::Sigmod* sigmod); + + QString types() const; public slots: void addObject(Sigmod::Object* /*object = NULL*/); void deleteObject(BaseModel* /*model*/); diff --git a/sigmodr/models/SigmodModel.cpp b/sigmodr/models/SigmodModel.cpp index f7409275..7c96cb2b 100644 --- a/sigmodr/models/SigmodModel.cpp +++ b/sigmodr/models/SigmodModel.cpp @@ -106,10 +106,15 @@ bool Sigmodr::SigmodModel::setData(const QVariant& value, int role) setupData(); return true; } - else if (xml.doctype().name() == "Rules") + foreach (BaseModel* model, m_objects) { - qobject_cast<Sigmod::Sigmod*>(m_object)->setRules(xml.documentElement()); - return true; + GroupModel* group = qobject_cast<GroupModel*>(model); + if (group) + { + const bool used = group->setData(value, role); + if (used) + return true; + } } file.close(); } @@ -118,6 +123,11 @@ bool Sigmodr::SigmodModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SigmodModel::types() const +{ + return type().append(";Rules;Ability;Author;Badge;CoinList;EggGroup;GlobalScript;Item;ItemType;Map;Move;Nature;Skin;Sound;Species;Sprite;Status;Store;Tile;Time;Trainer;Type;Weather"); +} + void Sigmodr::SigmodModel::addObject(Sigmod::Object* /*object*/) { } diff --git a/sigmodr/models/SigmodModel.h b/sigmodr/models/SigmodModel.h index c1ddc544..1e5bfba4 100644 --- a/sigmodr/models/SigmodModel.h +++ b/sigmodr/models/SigmodModel.h @@ -40,6 +40,8 @@ class SigmodModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* /*object = NULL*/); void deleteObject(BaseModel* /*model*/); diff --git a/sigmodr/models/SkinGroupModel.cpp b/sigmodr/models/SkinGroupModel.cpp index 4f3402f5..61775e61 100644 --- a/sigmodr/models/SkinGroupModel.cpp +++ b/sigmodr/models/SkinGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::SkinGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SkinGroupModel::types() const +{ + return "Skin"; +} + void Sigmodr::SkinGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/SkinGroupModel.h b/sigmodr/models/SkinGroupModel.h index bd832055..4bf1a90a 100644 --- a/sigmodr/models/SkinGroupModel.h +++ b/sigmodr/models/SkinGroupModel.h @@ -39,6 +39,8 @@ class SkinGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/SoundGroupModel.cpp b/sigmodr/models/SoundGroupModel.cpp index 670a3188..0adfe1c4 100644 --- a/sigmodr/models/SoundGroupModel.cpp +++ b/sigmodr/models/SoundGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::SoundGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SoundGroupModel::types() const +{ + return "Sound"; +} + void Sigmodr::SoundGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/SoundGroupModel.h b/sigmodr/models/SoundGroupModel.h index 2076a9ad..e52ee582 100644 --- a/sigmodr/models/SoundGroupModel.h +++ b/sigmodr/models/SoundGroupModel.h @@ -39,6 +39,8 @@ class SoundGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/SpeciesAbilityGroupModel.cpp b/sigmodr/models/SpeciesAbilityGroupModel.cpp index 8014c01d..416b112f 100644 --- a/sigmodr/models/SpeciesAbilityGroupModel.cpp +++ b/sigmodr/models/SpeciesAbilityGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::SpeciesAbilityGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SpeciesAbilityGroupModel::types() const +{ + return "SpeciesAbility"; +} + void Sigmodr::SpeciesAbilityGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/SpeciesAbilityGroupModel.h b/sigmodr/models/SpeciesAbilityGroupModel.h index 846be1b5..edd450cd 100644 --- a/sigmodr/models/SpeciesAbilityGroupModel.h +++ b/sigmodr/models/SpeciesAbilityGroupModel.h @@ -39,6 +39,8 @@ class SpeciesAbilityGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/SpeciesGroupModel.cpp b/sigmodr/models/SpeciesGroupModel.cpp index 5d108830..b1f6c579 100644 --- a/sigmodr/models/SpeciesGroupModel.cpp +++ b/sigmodr/models/SpeciesGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::SpeciesGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SpeciesGroupModel::types() const +{ + return "Species"; +} + void Sigmodr::SpeciesGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/SpeciesGroupModel.h b/sigmodr/models/SpeciesGroupModel.h index 12701b96..b3182236 100644 --- a/sigmodr/models/SpeciesGroupModel.h +++ b/sigmodr/models/SpeciesGroupModel.h @@ -39,6 +39,8 @@ class SpeciesGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/SpeciesItemGroupModel.cpp b/sigmodr/models/SpeciesItemGroupModel.cpp index f652b1c9..3e6d378c 100644 --- a/sigmodr/models/SpeciesItemGroupModel.cpp +++ b/sigmodr/models/SpeciesItemGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::SpeciesItemGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SpeciesItemGroupModel::types() const +{ + return "SpeciesItem"; +} + void Sigmodr::SpeciesItemGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/SpeciesItemGroupModel.h b/sigmodr/models/SpeciesItemGroupModel.h index 7d94ad5b..fcb3667a 100644 --- a/sigmodr/models/SpeciesItemGroupModel.h +++ b/sigmodr/models/SpeciesItemGroupModel.h @@ -39,6 +39,8 @@ class SpeciesItemGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/SpeciesModel.cpp b/sigmodr/models/SpeciesModel.cpp index 0addf10d..db2f36a0 100644 --- a/sigmodr/models/SpeciesModel.cpp +++ b/sigmodr/models/SpeciesModel.cpp @@ -88,6 +88,16 @@ bool Sigmodr::SpeciesModel::setData(const QVariant& value, int role) setupData(); return true; } + foreach (BaseModel* model, m_objects) + { + GroupModel* group = qobject_cast<GroupModel*>(model); + if (group) + { + const bool used = group->setData(value, role); + if (used) + return true; + } + } file.close(); } } @@ -95,6 +105,11 @@ bool Sigmodr::SpeciesModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SpeciesModel::types() const +{ + return type().append(";SpeciesAbility;SpeciesItem;SpeciesMove"); +} + void Sigmodr::SpeciesModel::addObject(Sigmod::Object* /*object*/) { } diff --git a/sigmodr/models/SpeciesModel.h b/sigmodr/models/SpeciesModel.h index a523b9f6..54750b95 100644 --- a/sigmodr/models/SpeciesModel.h +++ b/sigmodr/models/SpeciesModel.h @@ -40,6 +40,8 @@ class SpeciesModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* /*object = NULL*/); void deleteObject(BaseModel* /*model*/); diff --git a/sigmodr/models/SpeciesMoveGroupModel.cpp b/sigmodr/models/SpeciesMoveGroupModel.cpp index e992a215..d6636f24 100644 --- a/sigmodr/models/SpeciesMoveGroupModel.cpp +++ b/sigmodr/models/SpeciesMoveGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::SpeciesMoveGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SpeciesMoveGroupModel::types() const +{ + return "SpeciesMove"; +} + void Sigmodr::SpeciesMoveGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/SpeciesMoveGroupModel.h b/sigmodr/models/SpeciesMoveGroupModel.h index c7f3000b..9b9b1f32 100644 --- a/sigmodr/models/SpeciesMoveGroupModel.h +++ b/sigmodr/models/SpeciesMoveGroupModel.h @@ -39,6 +39,8 @@ class SpeciesMoveGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/SpriteGroupModel.cpp b/sigmodr/models/SpriteGroupModel.cpp index 7fe1940e..f6e4ac4c 100644 --- a/sigmodr/models/SpriteGroupModel.cpp +++ b/sigmodr/models/SpriteGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::SpriteGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::SpriteGroupModel::types() const +{ + return "Sprite"; +} + void Sigmodr::SpriteGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/SpriteGroupModel.h b/sigmodr/models/SpriteGroupModel.h index bacacaae..59840655 100644 --- a/sigmodr/models/SpriteGroupModel.h +++ b/sigmodr/models/SpriteGroupModel.h @@ -39,6 +39,8 @@ class SpriteGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/StatusGroupModel.cpp b/sigmodr/models/StatusGroupModel.cpp index c9b0fbf1..2bba3102 100644 --- a/sigmodr/models/StatusGroupModel.cpp +++ b/sigmodr/models/StatusGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::StatusGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::StatusGroupModel::types() const +{ + return "Status"; +} + void Sigmodr::StatusGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/StatusGroupModel.h b/sigmodr/models/StatusGroupModel.h index 372057c3..916f4d1c 100644 --- a/sigmodr/models/StatusGroupModel.h +++ b/sigmodr/models/StatusGroupModel.h @@ -39,6 +39,8 @@ class StatusGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/StoreGroupModel.cpp b/sigmodr/models/StoreGroupModel.cpp index 4935f73c..6588b70e 100644 --- a/sigmodr/models/StoreGroupModel.cpp +++ b/sigmodr/models/StoreGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::StoreGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::StoreGroupModel::types() const +{ + return "Store"; +} + void Sigmodr::StoreGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/StoreGroupModel.h b/sigmodr/models/StoreGroupModel.h index f1b2d569..413fd16c 100644 --- a/sigmodr/models/StoreGroupModel.h +++ b/sigmodr/models/StoreGroupModel.h @@ -39,6 +39,8 @@ class StoreGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/TileGroupModel.cpp b/sigmodr/models/TileGroupModel.cpp index 56f15686..291549ac 100644 --- a/sigmodr/models/TileGroupModel.cpp +++ b/sigmodr/models/TileGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::TileGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::TileGroupModel::types() const +{ + return "Tile"; +} + void Sigmodr::TileGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/TileGroupModel.h b/sigmodr/models/TileGroupModel.h index f97e93d7..9d81d15c 100644 --- a/sigmodr/models/TileGroupModel.h +++ b/sigmodr/models/TileGroupModel.h @@ -39,6 +39,8 @@ class TileGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/TimeGroupModel.cpp b/sigmodr/models/TimeGroupModel.cpp index 17f977f7..061ef821 100644 --- a/sigmodr/models/TimeGroupModel.cpp +++ b/sigmodr/models/TimeGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::TimeGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::TimeGroupModel::types() const +{ + return "Time"; +} + void Sigmodr::TimeGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/TimeGroupModel.h b/sigmodr/models/TimeGroupModel.h index c81bbf7d..03df275a 100644 --- a/sigmodr/models/TimeGroupModel.h +++ b/sigmodr/models/TimeGroupModel.h @@ -39,6 +39,8 @@ class TimeGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/TrainerGroupModel.cpp b/sigmodr/models/TrainerGroupModel.cpp index ded2f278..fbf45700 100644 --- a/sigmodr/models/TrainerGroupModel.cpp +++ b/sigmodr/models/TrainerGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::TrainerGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::TrainerGroupModel::types() const +{ + return "Trainer"; +} + void Sigmodr::TrainerGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/TrainerGroupModel.h b/sigmodr/models/TrainerGroupModel.h index 217cf9ab..e12f8812 100644 --- a/sigmodr/models/TrainerGroupModel.h +++ b/sigmodr/models/TrainerGroupModel.h @@ -39,6 +39,8 @@ class TrainerGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/TypeGroupModel.cpp b/sigmodr/models/TypeGroupModel.cpp index e50adae2..ce8f85a6 100644 --- a/sigmodr/models/TypeGroupModel.cpp +++ b/sigmodr/models/TypeGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::TypeGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::TypeGroupModel::types() const +{ + return "Type"; +} + void Sigmodr::TypeGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/TypeGroupModel.h b/sigmodr/models/TypeGroupModel.h index f45ad51b..b78353e4 100644 --- a/sigmodr/models/TypeGroupModel.h +++ b/sigmodr/models/TypeGroupModel.h @@ -39,6 +39,8 @@ class TypeGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); diff --git a/sigmodr/models/WeatherGroupModel.cpp b/sigmodr/models/WeatherGroupModel.cpp index 96d0a87e..7d36cb21 100644 --- a/sigmodr/models/WeatherGroupModel.cpp +++ b/sigmodr/models/WeatherGroupModel.cpp @@ -75,6 +75,11 @@ bool Sigmodr::WeatherGroupModel::setData(const QVariant& value, int role) return false; } +QString Sigmodr::WeatherGroupModel::types() const +{ + return "Weather"; +} + void Sigmodr::WeatherGroupModel::addObject(Sigmod::Object* object) { if (!object) diff --git a/sigmodr/models/WeatherGroupModel.h b/sigmodr/models/WeatherGroupModel.h index dc670f98..774e398e 100644 --- a/sigmodr/models/WeatherGroupModel.h +++ b/sigmodr/models/WeatherGroupModel.h @@ -39,6 +39,8 @@ class WeatherGroupModel : public GroupModel QVariant data(const int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); + + QString types() const; public slots: void addObject(Sigmod::Object* object = NULL); void deleteObject(BaseModel* model); |