当前位置: 首页>>代码示例>>C++>>正文


C++ Plug::getNode方法代码示例

本文整理汇总了C++中Plug::getNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Plug::getNode方法的具体用法?C++ Plug::getNode怎么用?C++ Plug::getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plug的用法示例。


在下文中一共展示了Plug::getNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeEdge

void Scene::removeEdge(PlugEdge* edge)
{
    Plug* fromPlug = edge->getStartPlug();
    Plug* toPlug = edge->getEndPlug();
    QPair<Plug*, Plug*> edgeKey(fromPlug, toPlug);
#ifdef QT_DEBUG
    Q_ASSERT(m_edges.contains(edgeKey));
#else
    if(!m_edges.contains(edgeKey)){
        return;
    }
#endif

    // unregister from the connected plugs
    fromPlug->removeEdge(edge);
    toPlug->removeEdge(edge);

    // remove the edge from the Scene's register
    m_edges.remove(edgeKey);

    // remove the edge from its group
    EdgeGroup* edgeGroup  = edge->getGroup();
    edgeGroup->removeEdge(edge);

    // if the group is now empty, we can only delete it if the other group in the pair is also empty
    EdgeGroupPair* edgeGroupPair = edgeGroup->getEdgeGroupPair();
    if(edgeGroupPair->isEmpty()){
        uint firstHash = edgeGroupPair->getFirstGroup()->getHash();
        uint secondHash = edgeGroupPair->getSecondGroup()->getHash();
        Q_ASSERT(m_edgeGroups.contains(firstHash));
        Q_ASSERT(m_edgeGroups.contains(secondHash));
        m_edgeGroups.remove(firstHash);
        m_edgeGroups.remove(secondHash);
        m_edgeGroupPairs.remove(edgeGroupPair);
        delete edgeGroupPair; // also deletes the EdgeGroups
        edgeGroupPair = nullptr;
    }

    // lastly, remove the QGraphicsItem from the scene, thereby taking possession of the last pointer to the edge
    removeItem(edge);

    // delete the edge from memory (automatically deletes all Qt-children as well)
    edge->deleteLater();

    // emit signals
    emit fromPlug->getNode()->outputDisconnected(fromPlug, toPlug);
    emit toPlug->getNode()->inputDisconnected(toPlug, fromPlug);
}
开发者ID:eliemichel,项目名称:ZodiacGraph,代码行数:48,代码来源:scene.cpp


注:本文中的Plug::getNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。