MCPcopy Create free account
hub / github.com/MITK/MITK / dropMimeData

Method dropMimeData

Modules/QtWidgets/src/QmitkRenderWindowDataNodeTableModel.cpp:349–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349bool 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}

Callers

nothing calls this directly

Calls 4

dataMethod · 0.95
moveNodesLayerMethod · 0.95
LockMethod · 0.45
GetIntPropertyMethod · 0.45

Tested by

no test coverage detected