diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-05-02 03:30:21 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-05-02 03:30:21 -0400 |
commit | 8c4f7cb56c460f02abe78088ea3ea259fd5ec49a (patch) | |
tree | 649a07f5c7fad34fd379933f04bd4b55d05b2afb /sigmodr/tree/TreeModel.cpp | |
parent | 338ef3cd3cebee1450f1cdc998f608680b3c5f25 (diff) | |
download | sigen-8c4f7cb56c460f02abe78088ea3ea259fd5ec49a.tar.gz sigen-8c4f7cb56c460f02abe78088ea3ea259fd5ec49a.tar.xz sigen-8c4f7cb56c460f02abe78088ea3ea259fd5ec49a.zip |
Grab data from the selected indexes
Diffstat (limited to 'sigmodr/tree/TreeModel.cpp')
-rw-r--r-- | sigmodr/tree/TreeModel.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sigmodr/tree/TreeModel.cpp b/sigmodr/tree/TreeModel.cpp index 8331d7a2..723bfa4a 100644 --- a/sigmodr/tree/TreeModel.cpp +++ b/sigmodr/tree/TreeModel.cpp @@ -90,6 +90,18 @@ QStringList TreeModel::mimeTypes() const QMimeData* TreeModel::mimeData(const QModelIndexList& indexes) const { + QMimeData* data = new QMimeData; + QDomDocument document("SigmodCopyData"); + foreach (const QModelIndex& index, indexes) + { + if (!index.isValid()) + continue; + TreeItem* item = static_cast<TreeItem*>(index.internalPointer()); + if (item->canEdit()) + document.appendChild(item->copyData()); + } + data->setData("application/x-sigmod-copy+xml", document.toByteArray()); + return data; } bool TreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action, const int row, const int column, const QModelIndex& parent) |