diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-25 21:09:05 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-25 21:09:05 +0000 |
| commit | e13073c4357b2b85eba8a015f38e9f69f4d1799c (patch) | |
| tree | c301321da7066a8722469947f024b60a382ca77b /pokemodr/models/CoinListModel.cpp | |
| parent | 74c06767a1a698705e8c486d77ccf11838c87a4d (diff) | |
| download | sigen-e13073c4357b2b85eba8a015f38e9f69f4d1799c.tar.gz sigen-e13073c4357b2b85eba8a015f38e9f69f4d1799c.tar.xz sigen-e13073c4357b2b85eba8a015f38e9f69f4d1799c.zip | |
[FIX] Drag/Drop should work (in theory)
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@109 6ecfd1a5-f3ed-3746-8530-beee90d26b22
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); |
