本文整理汇总了C++中Datum::acceptsLink方法的典型用法代码示例。如果您正苦于以下问题:C++ Datum::acceptsLink方法的具体用法?C++ Datum::acceptsLink怎么用?C++ Datum::acceptsLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datum
的用法示例。
在下文中一共展示了Datum::acceptsLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseReleaseEvent
void Connection::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsObject::mouseReleaseEvent(event);
if (drag_state == CONNECTED)
return;
ungrabMouse();
clearFocus();
setFlag(QGraphicsItem::ItemIsFocusable, false);
InputPort* target = gscene()->getInputPortAt(endPos());
Datum* datum = target ? target->getDatum() : NULL;
if (target && datum->acceptsLink(link))
{
datum->addLink(link);
drag_state = CONNECTED;
connect(endInspector(), &NodeInspector::moved,
this, &Connection::onInspectorMoved);
connect(endInspector(), &NodeInspector::hiddenChanged,
this, &Connection::onHiddenChanged);
App::instance()->pushStack(new UndoAddLinkCommand(link));
}
else
{
link->deleteLater();
}
prepareGeometryChange();
}
示例2: mouseReleaseEvent
void Connection::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsObject::mouseReleaseEvent(event);
if (drag_state == CONNECTED)
return;
ungrabMouse();
clearFocus();
setFlag(QGraphicsItem::ItemIsFocusable, false);
InputPort* t = gscene()->getInputPortAt(endPos());
Datum* datum = target ? target->getDatum() : NULL;
if (t && datum->acceptsLink(source->getDatum()))
{
target = t;
t->install(this);
datum->installLink(source->getDatum());
drag_state = CONNECTED;
App::instance()->pushStack(
new UndoAddLinkCommand(source->getDatum(), datum));
onPortsMoved();
emit(changed());
}
else
{
deleteLater();
}
prepareGeometryChange();
}