MCPcopy Create free account
hub / github.com/commontk/CTK / removeConnection

Method removeConnection

Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.cpp:444–477  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

442
443//-----------------------------------------------------------------------------
444int ctkVTKObjectEventsObserver::removeConnection(vtkObject* vtk_obj, unsigned long vtk_event,
445 const QObject* qt_obj, const char* qt_slot)
446{
447 Q_D(ctkVTKObjectEventsObserver);
448
449 QList<ctkVTKConnection*> connections =
450 d->findConnections(vtk_obj, vtk_event, qt_obj, qt_slot);
451
452 foreach (ctkVTKConnection* connection, connections)
453 {
454 delete connection;
455 }
456
457 // Only remove shadow connections (connections in the index without a corresponding actual connection)
458 // from the index if the index size grew too big (shadow elements ratio >50% and minimum 100)
459 if (static_cast<int>(d->ConnectionIndex.size())>100+children().count()*2)
460 {
461 for (ctkVTKObjectEventsObserverPrivate::ConnectionIndexType::iterator connectionIt=d->ConnectionIndex.begin();
462 connectionIt!=d->ConnectionIndex.end();
463 /*upon deletion the increment is done already, so don't increment here*/)
464 {
465 ctkVTKConnection* connection=connectionIt.value();
466 if (!children().contains(connection))
467 {
468 // connection has been deleted, so remove it from the index
469 connectionIt=d->ConnectionIndex.erase(connectionIt);
470 continue;
471 }
472 ++connectionIt;
473 }
474 }
475
476 return connections.count();
477}
478
479//-----------------------------------------------------------------------------
480int ctkVTKObjectEventsObserver::removeAllConnections()

Callers 3

addConnectionMethod · 0.95
reconnectionMethod · 0.95
removeAllConnectionsMethod · 0.95

Calls 6

findConnectionsMethod · 0.80
eraseMethod · 0.80
sizeMethod · 0.45
countMethod · 0.45
valueMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected