@@ -240,6 +240,7 @@ void NetworkEditor::connectNewModule(const ModuleHandle& moduleToConnectTo, cons
240240 if (newConnectionInputPort)
241241 {
242242 qDebug () << " found port object to connect up with:" << newConnectionInputPort;
243+ controller_->removeConnection (*newConnectionInputPort->firstConnectionId ());
243244 newConnectionInputPort->deleteConnectionsLater ();
244245 }
245246 else
@@ -359,11 +360,19 @@ void NetworkEditor::setupModuleWidget(ModuleWidget* module)
359360 connect (this , SIGNAL (networkExecuted ()), module , SLOT (resetProgressBar ()));
360361
361362 proxy->setZValue (zLevelManager_->get_max ());
362- while (!scene_->items (lastModulePosition_.x () - 20 , lastModulePosition_.y () - 20 , 40 , 40 ).isEmpty ())
363+
364+ if (!insertingNewModuleAlongConnection_)
365+ {
366+ while (!scene_->items (lastModulePosition_.x () - 20 , lastModulePosition_.y () - 20 , 40 , 40 ).isEmpty ())
367+ {
368+ lastModulePosition_ += QPointF (20 , -20 );
369+ }
370+ proxy->setPos (lastModulePosition_);
371+ }
372+ else
363373 {
364- lastModulePosition_ += QPointF ( 20 , - 20 );
374+ // TODO: find midpoint of two connected modules, set position there
365375 }
366- proxy->setPos (lastModulePosition_);
367376
368377 proxy->setFlags (QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges);
369378 connect (scene_, SIGNAL (selectionChanged ()), proxy, SLOT (highlightIfSelected ()));
0 commit comments