MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / mouseReleaseEvent

Method mouseReleaseEvent

ImagePlay/src/IPProcessStep.cpp:421–507  ·  view source on GitHub ↗

! * \brief IPProcessStep::mouseReleaseEvent * \param event */

Source from the content-addressed store, hash-verified

419 * \param event
420 */
421void IPProcessStep::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
422{
423 IPProcessGridScene* scn = (IPProcessGridScene*) scene();
424
425 // bring the items to the background again
426 setZValue(0);
427 if(scene()->selectedItems().length() > 1)
428 {
429 for(int i=0; i < scene()->selectedItems().length(); i++)
430 {
431 IPProcessStep* item = (IPProcessStep*) scene()->selectedItems().at(i);
432 item->setZValue(0);
433 }
434 }
435
436 // check for items for connection
437 if(_connecting)
438 {
439 // there is currently only 1 view
440 QGraphicsView* view = scn->views()[0];
441 // transform is needed because of zooming capabilities
442 QGraphicsItem* tmpItem = scn->itemAt(event->scenePos(), view->transform());
443 if(tmpItem && typeid(*tmpItem) == typeid(IPProcessStep))
444 {
445 IPProcessStep* otherItem = (IPProcessStep*) tmpItem;
446 if(process()->availableOutputs() > 0 && otherItem->process()->availableInputs() > 0)
447 {
448
449 // if source or destination have multiple inputs/outputs show connection dialog
450 if(process()->outputs()->size() > 1 || otherItem->process()->inputs()->size() > 1)
451 {
452 ConnectionDialog* connectionDialog = new ConnectionDialog(this, otherItem, scn, _mainWindow);
453 connectionDialog->show();
454 }
455 else
456 {
457 _mainWindow->addEdge(new IPProcessEdge(this, otherItem, 0, 0));
458 }
459 }
460
461 }
462 _connecting = false;
463
464 ((IPProcessGridScene*) scene())->setTmpArrowVisible(false);
465 return;
466 }
467
468 // snap after dragging
469 snapToGrid();
470
471 // snap all if multiselect
472 bool groupIsColliding = false;
473 if(scene()->selectedItems().length() > 0)
474 {
475 for(int i=0; i < scene()->selectedItems().length(); i++)
476 {
477 IPProcessStep* item = (IPProcessStep*) scene()->selectedItems().at(i);
478 for(QGraphicsItem* currentItem : item->collidingItems())

Callers

nothing calls this directly

Calls 11

processFunction · 0.85
lengthMethod · 0.80
transformMethod · 0.80
availableOutputsMethod · 0.80
availableInputsMethod · 0.80
setTmpArrowVisibleMethod · 0.80
snapToGridMethod · 0.80
atMethod · 0.45
processMethod · 0.45
sizeMethod · 0.45
addEdgeMethod · 0.45

Tested by

no test coverage detected