refactoring, moving out GraphWidget::modifyRoute

master
dmatetelki 10 years ago
parent 91972ea943
commit 2728f36c25

@ -192,6 +192,15 @@ void GraphWidget::keyPressEvent(QKeyEvent *e)
break; break;
} }
case Qt::Key_Space: { case Qt::Key_Space: {
modifyRoute();
}
default:
QGraphicsView::keyPressEvent(e);
}
}
void GraphWidget::modifyRoute()
{
for (QList<Edge*>::iterator it = m_route.begin(); it != m_route.end(); ++it) for (QList<Edge*>::iterator it = m_route.begin(); it != m_route.end(); ++it)
(*it)->setIsRoute(false); (*it)->setIsRoute(false);
@ -215,10 +224,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *e)
(*it)->setIsRoute(true); (*it)->setIsRoute(true);
} }
} }
default:
QGraphicsView::keyPressEvent(e);
}
}
void GraphWidget::removeEdge(Node* selectedNode, Node* nodeUnderMouse) void GraphWidget::removeEdge(Node* selectedNode, Node* nodeUnderMouse)
{ {

@ -38,6 +38,7 @@ private:
void removeNode(Node* selectedNode); void removeNode(Node* selectedNode);
void insertEdge(Node* selectedNode, Node* nodeUnderMouse); void insertEdge(Node* selectedNode, Node* nodeUnderMouse);
void removeEdge(Node* selectedNode, Node* nodeUnderMouse); void removeEdge(Node* selectedNode, Node* nodeUnderMouse);
void modifyRoute();
Graph<float2>* m_graph; Graph<float2>* m_graph;
QPixmap* m_background; QPixmap* m_background;

Loading…
Cancel
Save