diff options
Diffstat (limited to 'pokemodr/models/CoinListModel.cpp')
| -rw-r--r-- | pokemodr/models/CoinListModel.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pokemodr/models/CoinListModel.cpp b/pokemodr/models/CoinListModel.cpp index fcbadf4b..a66a8a35 100644 --- a/pokemodr/models/CoinListModel.cpp +++ b/pokemodr/models/CoinListModel.cpp @@ -48,7 +48,13 @@ QVariant CoinListModel::data(int role) const { if (role == Qt::DisplayRole) return static_cast<CoinList*>(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 CoinListUI(static_cast<CoinList*>(m_object), NULL); return QVariant::fromValue(widget); @@ -63,7 +69,7 @@ int CoinListModel::rowCount() const bool CoinListModel::setData(const QVariant& value, int role) { - if (role == Qt::UserRole) + if (role == BaseModel::XmlRole) { if (value.canConvert<QString>()) { @@ -113,11 +119,6 @@ bool CoinListModel::removeRows(const int position, const int rows) return true; } -// bool CoinListModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column) -// { -// // TODO: drag/drop -// } - void CoinListModel::setupData() { CoinList* coinList = static_cast<CoinList*>(m_object); |
