| 347 | } |
| 348 | |
| 349 | bool QmitkRenderWindowDataNodeTableModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int /*row*/, int /*column*/, const QModelIndex& parent) |
| 350 | { |
| 351 | if (action == Qt::IgnoreAction) |
| 352 | { |
| 353 | return true; |
| 354 | } |
| 355 | |
| 356 | if (!data->hasFormat(QmitkMimeTypes::DataNodePtrs)) |
| 357 | { |
| 358 | return false; |
| 359 | } |
| 360 | |
| 361 | if (parent.isValid()) |
| 362 | { |
| 363 | int layer = -1; |
| 364 | auto targetNode = this->data(parent, QmitkDataNodeRawPointerRole).value<mitk::DataNode*>(); |
| 365 | auto movedNodes = QmitkMimeTypes::ToDataNodePtrList(data); |
| 366 | |
| 367 | // In the table model, each column has its own entry. To avoid duplicate moving, filter out unique nodes. |
| 368 | QSet<mitk::DataNode*> uniqueMovedNodes; |
| 369 | for (const auto& dataNode : std::as_const(movedNodes)) |
| 370 | { |
| 371 | uniqueMovedNodes.insert(dataNode); |
| 372 | } |
| 373 | |
| 374 | auto baseRenderer = m_BaseRenderer.Lock(); |
| 375 | if (nullptr != targetNode) |
| 376 | { |
| 377 | targetNode->GetIntProperty("layer", layer, baseRenderer); |
| 378 | } |
| 379 | |
| 380 | this->moveNodesLayer(uniqueMovedNodes, layer); |
| 381 | emit NodesLayerMoved(uniqueMovedNodes, layer); |
| 382 | |
| 383 | return true; |
| 384 | } |
| 385 | |
| 386 | return false; |
| 387 | } |
nothing calls this directly
no test coverage detected