summaryrefslogtreecommitdiffstats
path: root/pokemodr/models/AbilityEffectModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/models/AbilityEffectModel.cpp')
-rw-r--r--pokemodr/models/AbilityEffectModel.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/pokemodr/models/AbilityEffectModel.cpp b/pokemodr/models/AbilityEffectModel.cpp
index ce6602b6..b6221562 100644
--- a/pokemodr/models/AbilityEffectModel.cpp
+++ b/pokemodr/models/AbilityEffectModel.cpp
@@ -38,7 +38,13 @@ QVariant AbilityEffectModel::data(int role) const
{
if (role == Qt::DisplayRole)
return AbilityEffect::EffectStr[static_cast<AbilityEffect*>(m_object)->effect()];
- else if (role == Qt::UserRole)
+ else if (role == BaseModel::XmlRole)
+ {
+ QDomDocument xml(m_object->className());
+ xml.appendChild(m_object->save());
+ return xml.toString();
+ }
+ else if (role == BaseModel::WidgetRole)
{
// TODO: AbilityEffectUI
// QWidget* widget = new AbilityEffectUI(static_cast<AbilityEffect*>(m_object), NULL);
@@ -49,7 +55,7 @@ QVariant AbilityEffectModel::data(int role) const
bool AbilityEffectModel::setData(const QVariant& value, int role)
{
- if (role == Qt::UserRole)
+ if (role == BaseModel::XmlRole)
{
if (value.canConvert<QString>())
{
@@ -73,8 +79,3 @@ int AbilityEffectModel::indexNumber() const
{
// TODO: get effect index
}
-
-// bool AbilityEffectModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column)
-// {
-// // TODO: drag/drop
-// }