Skip to content

Commit 8b41a68

Browse files
committed
Add dummy ports
1 parent 21dd1f9 commit 8b41a68

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/Interface/Application/Subnetworks.cc

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ void NetworkEditor::setupPortHolder(const std::vector<SharedPointer<PortDescript
215215
portsBridge->setToolTip(name);
216216

217217
auto layout = new QHBoxLayout;
218-
layout->setSpacing(4);
218+
layout->setSpacing(15);
219219
layout->setAlignment(Qt::AlignLeft);
220-
layout->setContentsMargins(5, 0, 5, 0);
220+
layout->setContentsMargins(15, 0, 5, 0);
221221

222222
auto visible = visibleRect();
223223

@@ -228,7 +228,7 @@ void NetworkEditor::setupPortHolder(const std::vector<SharedPointer<PortDescript
228228
proxy->setMinimumWidth(visible.width());
229229
proxy->setData(123, name);
230230

231-
int offset = 12;
231+
int offset = 40;
232232
for (const auto& port : ports)
233233
{
234234
SubnetPortWidgetCtorArgs args { QString::fromStdString(port->get_portname()),
@@ -251,10 +251,34 @@ void NetworkEditor::setupPortHolder(const std::vector<SharedPointer<PortDescript
251251
// << portRewiringMap2_[port->id().toString()]->id().id_.c_str();
252252

253253
portRewiringMap_[port->id().toString()]->addSubnetCompanion(portRepl);
254-
offset += portRepl->properWidth() + 3;
254+
offset += portRepl->properWidth() + 10;
255255
portsBridge->addPort(portRepl);
256256
}
257257

258+
//TODO: get from somewhere else
259+
std::vector<QString> types{"Field", "Matrix", "String", "Geometry", "Bundle", "Nrrd"};
260+
for (const auto& type : types)
261+
{
262+
SubnetPortWidgetCtorArgs args { "Test" + type,
263+
to_color(PortColorLookup::toColor(type.toStdString()), 230), type.toStdString(),
264+
[this](){ return boost::make_shared<ConnectionFactory>([this]() { return scene_; }); },
265+
[this](){ return boost::make_shared<ClosestPortFinder>([this]() { return scene_; }); },
266+
nullptr};
267+
268+
PortWidget* testPort;
269+
if (name == "Outputs") // flip input and output designation here.
270+
testPort = new SubnetInputPortWidget(args);
271+
else // Inputs
272+
testPort = new SubnetOutputPortWidget(args);
273+
274+
layout->addWidget(testPort);
275+
testPort->setSceneFunc([this]() { return scene_; });
276+
testPort->setPositionObject(boost::make_shared<LambdaPositionProvider>([proxy, offset]() { return proxy->pos() + QPointF(offset, 0); }));
277+
offset += testPort->properWidth() + 3;
278+
portsBridge->addPort(testPort);
279+
testPort->hide();
280+
}
281+
258282
portsBridge->setLayout(layout);
259283

260284
scene_->addItem(proxy);

0 commit comments

Comments
 (0)