Commit 7e8db7de authored by Oliver Bock's avatar Oliver Bock
Browse files

Improved component link visualization

* Links are now drawn in blue when selected
* Applies to left button selection as well as context menu display


git-svn-id: https://svn.origo.ethz.ch/fidelity@26 53d1999f-d1a8-4366-aa61-588fded17473
parent e3a36059
......@@ -137,16 +137,19 @@ void Fidelity::GUI::ComponentLinkItem::paint(QPainter* painter, const QStyleOpti
painter->drawPolygon(m_StartArrowHead);
}
if(isSelected()) {
setPen(QPen(Qt::blue, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
}
else if(pen().color() == Qt::blue) {
if(m_LinkType == BeamLink) {
setPen(QPen(Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
}
else if(m_LinkType == ControlLink) {
setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
}
}
painter->drawLine(line());
// if (isSelected()) {
// painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
// QLineF myLine = line();
// myLine.translate(0, m_ArrowSize);
// painter->drawLine(myLine);
// myLine.translate(0,-m_ArrowSize * 2);
// painter->drawLine(myLine);
// }
}
// Public methods
......
......@@ -87,7 +87,7 @@ void Fidelity::GUI::WorkbenchScene::mouseReleaseEvent(QGraphicsSceneMouseEvent*
if(beamNode!=NULL) {
ComponentLinkItem* beamLink = new ComponentLinkItem(
BeamLink,
m_NewLinkNode,
m_NewLinkNode,
beamNode);
// Connect link to me for position update notifications
......@@ -199,6 +199,9 @@ void Fidelity::GUI::WorkbenchScene::contextMenuEvent(QGraphicsSceneContextMenuEv
}
}
else if(linkItem) {
// Select link
linkItem->setSelected(true);
// Create link context menu
QMenu linkMenu;
QAction* uniLinkAction = linkMenu.addAction("Unidirectional");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment