| 191 | } |
| 192 | |
| 193 | QMimeData* StructSelectModel::mimeData(const QModelIndexList& indexes) const |
| 194 | { |
| 195 | QMimeData* mimeData = new QMimeData; |
| 196 | QByteArray data; |
| 197 | |
| 198 | QDataStream stream(&data, QIODevice::WriteOnly); |
| 199 | QList<StructTreeNode*> nodes; |
| 200 | |
| 201 | foreach (const QModelIndex& index, indexes) |
| 202 | { |
| 203 | StructTreeNode* node = static_cast<StructTreeNode*>(index.internalPointer()); |
| 204 | if (!nodes.contains(node)) |
| 205 | nodes << node; |
| 206 | } |
| 207 | StructTreeNode* leastDeepNode = getLeastDeepNodeFromList(nodes); |
| 208 | const qulonglong leastDeepPointer{Common::bit_cast<qulonglong, StructTreeNode*>(leastDeepNode)}; |
| 209 | stream << leastDeepPointer; |
| 210 | stream << static_cast<int>(nodes.count()); |
| 211 | foreach (StructTreeNode* node, nodes) |
| 212 | { |
| 213 | const auto pointer{Common::bit_cast<qulonglong, StructTreeNode*>(node)}; |
| 214 | stream << pointer; |
| 215 | } |
| 216 | mimeData->setData("application/x-structtreenode", data); |
| 217 | return mimeData; |
| 218 | } |
| 219 | |
| 220 | StructTreeNode* |
| 221 | StructSelectModel::getLeastDeepNodeFromList(const QList<StructTreeNode*>& nodes) const |