Skip to content

Commit 4089514

Browse files
committed
Insert new module: first, connect to existing slot
1 parent 62bd03f commit 4089514

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/Interface/Application/Connection.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ namespace SCIRun
238238
class ConnectionLineNoteDisplayStrategy : public NoteDisplayStrategy
239239
{
240240
public:
241-
virtual QPointF relativeNotePosition(QGraphicsItem* item, const QGraphicsTextItem* note, NotePosition position) const override
241+
virtual QPointF relativeNotePosition(QGraphicsItem*, const QGraphicsTextItem*, NotePosition) const override
242242
{
243243
return QPointF(0,0);
244244
}
@@ -290,6 +290,9 @@ ConnectionLine::ConnectionLine(PortWidget* fromPort, PortWidget* toPort, const C
290290

291291
connect(menu_->disableAction_, SIGNAL(triggered()), this, SLOT(toggleDisabled()));
292292

293+
connect(this, SIGNAL(insertNewModule(const SCIRun::Dataflow::Networks::PortDescriptionInterface*, const std::string&, const SCIRun::Dataflow::Networks::PortDescriptionInterface*)),
294+
fromPort_, SIGNAL(connectNewModule(const SCIRun::Dataflow::Networks::PortDescriptionInterface*, const std::string&)));
295+
293296
menu_->setStyleSheet(fromPort->styleSheet());
294297

295298
trackNodes();
@@ -453,7 +456,9 @@ QVariant ConnectionLine::itemChange(GraphicsItemChange change, const QVariant& v
453456

454457
void ConnectionLine::insertNewModule()
455458
{
456-
qDebug() << "INSERTING NEW MODULE";
459+
auto action = qobject_cast<QAction*>(sender());
460+
auto moduleToAddName = action->text();
461+
Q_EMIT insertNewModule(fromPort_, moduleToAddName.toStdString(), toPort_);
457462
}
458463

459464
ModuleIdPair ConnectionLine::getConnectedToModuleIds() const

src/Interface/Application/Connection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public Q_SLOTS:
8686
Q_SIGNALS:
8787
void deleted(const SCIRun::Dataflow::Networks::ConnectionId& id);
8888
void noteChanged();
89+
void insertNewModule(const SCIRun::Dataflow::Networks::PortDescriptionInterface* output, const std::string& newModuleName, const SCIRun::Dataflow::Networks::PortDescriptionInterface* input);
8990
protected:
9091
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
9192
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;

src/Interface/Application/Port.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,8 @@ void PortWidget::portCachingChanged(bool checked)
598598

599599
void PortWidget::connectNewModule()
600600
{
601-
QAction* action = qobject_cast<QAction*>(sender());
602-
QString moduleToAddName = action->text();
601+
auto action = qobject_cast<QAction*>(sender());
602+
auto moduleToAddName = action->text();
603603
Q_EMIT connectNewModule(this, moduleToAddName.toStdString());
604604
}
605605

0 commit comments

Comments
 (0)