diff options
Diffstat (limited to 'pokemodr/models/StoreModel.cpp')
| -rw-r--r-- | pokemodr/models/StoreModel.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pokemodr/models/StoreModel.cpp b/pokemodr/models/StoreModel.cpp index 37dd199e..acf100fd 100644 --- a/pokemodr/models/StoreModel.cpp +++ b/pokemodr/models/StoreModel.cpp @@ -42,7 +42,13 @@ QVariant StoreModel::data(int role) const { if (role == Qt::DisplayRole) return static_cast<Store*>(m_object)->name(); - 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) { QWidget* widget = new StoreUI(static_cast<Store*>(m_object), NULL); return QVariant::fromValue(widget); @@ -52,7 +58,7 @@ QVariant StoreModel::data(int role) const bool StoreModel::setData(const QVariant& value, int role) { - if (role == Qt::UserRole) + if (role == BaseModel::XmlRole) { if (value.canConvert<QString>()) { @@ -76,8 +82,3 @@ int StoreModel::indexNumber() const { return m_object->pokemod()->storeIndex(m_object->id()); } - -// bool StoreModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column) -// { -// // TODO: drag/drop -// } |
