cannot remove not existing edges

master
Denes Matetelki 14 years ago
parent c19af27b62
commit b947ebf2ad

@ -295,7 +295,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
}
if (m_edgeDeleting)
{
m_activeNode->removeEdge(m_hintNode);
removeEdge(m_activeNode, m_hintNode);
m_edgeDeleting = false;
}
else // selecting
@ -511,7 +511,7 @@ void GraphWidget::showingNodeNumbersBeginWithNumber(const int &number,
}
if (m_edgeDeleting)
{
m_activeNode->removeEdge(m_hintNode);
removeEdge(m_activeNode, m_hintNode);
m_edgeDeleting = false;
}
else // selecting
@ -552,7 +552,7 @@ void GraphWidget::nodeSelected(Node *node)
}
if (m_edgeDeleting)
{
m_activeNode->removeEdge(node);
removeEdge(m_activeNode, node);
m_edgeDeleting = false;
}
else
@ -574,3 +574,17 @@ void GraphWidget::addEdge(const Node *source, const Node *destination)
m_scene->addItem(new Edge(m_activeNode, m_hintNode));
}
}
void GraphWidget::removeEdge(Node *source, Node *destination)
{
if (!source->isConnected(destination))
{
dynamic_cast<MainWindow *>(m_parent)->getStatusBar()->showMessage(
tr("There no edge between these two nodes."),
5000); // millisec
}
else
{
source->removeEdge(destination);
}
}

@ -38,6 +38,7 @@ private:
bool numberStartsWithNumber(const int &number, const int &prefix);
qreal calculateBiggestAngle(Node *node);
void addEdge(const Node *source, const Node *destination);
void removeEdge(Node* source, Node *destination);
QList<Node *> m_nodeList;
QWidget *m_parent;

Loading…
Cancel
Save