本文整理汇总了C++中NodeElement::getNearestPort方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeElement::getNearestPort方法的具体用法?C++ NodeElement::getNearestPort怎么用?C++ NodeElement::getNearestPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeElement
的用法示例。
在下文中一共展示了NodeElement::getNearestPort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseReleaseEvent
void EmbeddedLinker::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
hide();
master->selectionState(false);
EditorViewScene* scene = dynamic_cast<EditorViewScene*>(master->scene());
if (!mPressed && scene && mEdge) {
mEdge->hide();
QPointF const &eScenePos = event->scenePos();
NodeElement *under = dynamic_cast<NodeElement*>(scene->itemAt(eScenePos));
mEdge->show();
int result = 0;
if (!under) {
result = scene->launchEdgeMenu(mEdge, master, eScenePos);
NodeElement *target = dynamic_cast<NodeElement*>(scene->getLastCreated());
if (result == -1) {
mEdge = NULL;
} else if ((result == +1) && target) {
QPointF const &posRelativeToTheTarget = target->mapFromScene(eScenePos);
mEdge->placeEndTo(mapFromItem(target, target->getNearestPort(posRelativeToTheTarget)));
mEdge->connectToPort(); //it provokes to move target somehow, so it needs to place edge end and connect to port again
mEdge->placeEndTo(mapFromItem(target, target->getNearestPort(posRelativeToTheTarget)));
mEdge->adjustLink();
}
}
if (result != -1) {
mEdge->connectToPort();
}
}
}