ConnectorList CNItem::connectorList() { ConnectorList list; const NodeInfoMap::iterator nodeMapEnd = m_nodeMap.end(); for ( NodeInfoMap::iterator it = m_nodeMap.begin(); it != nodeMapEnd; ++it ) { Node *node = p_icnDocument->nodeWithID(it.data().id); if (node) { ConnectorList nodeList = node->getAllConnectors(); ConnectorList::iterator end = nodeList.end(); for ( ConnectorList::iterator it = nodeList.begin(); it != end; ++it ) { if ( *it && !list.contains(*it) ) { list.append(*it); } } } } return list; }
CircuitICNDocument::~CircuitICNDocument() { // Go to hell, KtlQCanvas. I'm in charge of what gets deleted. KtlQCanvasItemList all = m_canvas->allItems(); const KtlQCanvasItemList::Iterator end = all.end(); for ( KtlQCanvasItemList::Iterator it= all.begin(); it != end; ++it ) (*it)->setCanvas(0l); // Remove all items from the canvas selectAll(); deleteSelection(); // Delete anything that got through the above couple of lines ConnectorList connectorsToDelete = m_connectorList; connectorsToDelete.clear(); const ConnectorList::iterator connectorListEnd = connectorsToDelete.end(); for ( ConnectorList::iterator it = connectorsToDelete.begin(); it != connectorListEnd; ++it ) delete *it; deleteAllNodes(); }