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


C++ QSGNode类代码示例

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


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

示例1: indexForNode

void QuickSceneGraphModel::populateFromNode(QSGNode *node, bool emitSignals)
{
  if (!node) {
    return;
  }

  QVector<QSGNode*> &childList  = m_parentChildMap[node];
  QVector<QSGNode*> newChildList;

  newChildList.reserve(node->childCount());
  for (QSGNode *childNode = node->firstChild(); childNode; childNode = childNode->nextSibling()) {
    newChildList.append(childNode);
  }

  QModelIndex myIndex; // don't call indexForNode(node) here yet, in the common case of few changes we waste a lot of time here
  bool hasMyIndex = false;

  std::sort(newChildList.begin(), newChildList.end());

  QVector<QSGNode*>::iterator i = childList.begin();
  QVector<QSGNode*>::const_iterator j = newChildList.constBegin();

  while (i != childList.end() && j != newChildList.constEnd()) {
    if (*i < *j) { // handle deleted node
      emit nodeDeleted(*i);
      GET_INDEX
      if (emitSignals) {
        const auto idx = std::distance(childList.begin(), i);
        beginRemoveRows(myIndex, idx, idx);
      }
      pruneSubTree(*i);
      i = childList.erase(i);
      if (emitSignals)
        endRemoveRows();
    } else if (*i > *j) { // handle added node
开发者ID:ChristopherHahn,项目名称:GammaRay,代码行数:35,代码来源:quickscenegraphmodel.cpp

示例2: removeNodesToPreprocess

void QSGRenderer::removeNodesToPreprocess(QSGNode *node)
{
    for (QSGNode *c = node->firstChild(); c; c = c->nextSibling())
        removeNodesToPreprocess(c);
    if (node->flags() & QSGNode::UsePreprocess)
        m_nodes_to_preprocess.remove(node);
}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:7,代码来源:qsgrenderer.cpp

示例3: Q_ASSERT

void QSGRenderer::preprocess()
{
    Q_ASSERT(m_root_node);

    // We need to take a copy here, in case any of the preprocess calls deletes a node that
    // is in the preprocess list and thus, changes the m_nodes_to_preprocess behind our backs
    // For the default case, when this does not happen, the cost is neglishible.
    QSet<QSGNode *> items = m_nodes_to_preprocess;

    for (QSet<QSGNode *>::const_iterator it = items.constBegin();
         it != items.constEnd(); ++it) {
        QSGNode *n = *it;
        if (!nodeUpdater()->isNodeBlocked(n, m_root_node)) {
            n->preprocess();
        }
    }

#ifdef QSG_RENDERER_TIMING
    preprocessTime = frameTimer.elapsed();
#endif

    nodeUpdater()->setToplevelOpacity(context()->renderAlpha());
    nodeUpdater()->updateStates(m_root_node);

#ifdef QSG_RENDERER_TIMING
    updatePassTime = frameTimer.elapsed();
#endif

}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:29,代码来源:qsgrenderer.cpp

示例4: hide

void SatellitesItem::update() {
    if( ! m_satComp->selected() ) {
        hide();
        return;
    }

    QSGNode *n = firstChild();

    while(n != 0) {
        SatelliteNode *satNode = static_cast<SatelliteNode *>(n);
        Satellite *sat = satNode->sat();
        if ( sat->selected() ) {
            if ( Options::showVisibleSatellites() ) {
                if ( sat->isVisible() ) {
                    satNode->update();
                } else {
                    satNode->hide();
                }
            } else {
                satNode->update();
            }
        } else {
            satNode->hide();
        }
        n = n->nextSibling();
    }
}
开发者ID:KDE,项目名称:kstars,代码行数:27,代码来源:satellitesitem.cpp

示例5: QVariant

QVariant QuickSceneGraphModel::data(const QModelIndex &index, int role) const
{
  if (!index.isValid()) {
    return QVariant();
  }

  QSGNode *node = reinterpret_cast<QSGNode*>(index.internalPointer());

  if (role == Qt::DisplayRole) {
    if (index.column() == 0) {
      return Util::addressToString(node);
    } else if (index.column() == 1) {
      switch (node->type()) {
      case QSGNode::BasicNodeType:
        return "Node";
      case QSGNode::GeometryNodeType:
        return "Geometry Node";
      case QSGNode::TransformNodeType:
        return "Transform Node";
      case QSGNode::ClipNodeType:
        return "Clip Node";
      case QSGNode::OpacityNodeType:
        return "Opacity Node";
      case QSGNode::RootNodeType:
        return "Root Node";
      case QSGNode::RenderNodeType:
        return "Render Node";
      }
    }
  } else if (role == ObjectModel::ObjectRole) {
    return QVariant::fromValue(node);
  }

  return QVariant();
}
开发者ID:ChristopherHahn,项目名称:GammaRay,代码行数:35,代码来源:quickscenegraphmodel.cpp

示例6: QSGOpacityNode

void QQuickOpacityAnimatorJob::initialize(QQuickAnimatorController *controller)
{
    QQuickAnimatorJob::initialize(controller);
    QQuickItemPrivate *d = QQuickItemPrivate::get(m_target);
    if (d->extra.isAllocated()
            && d->extra->layer
            && d->extra->layer->enabled()) {
        d = QQuickItemPrivate::get(d->extra->layer->m_effectSource);
    }

    m_opacityNode = d->opacityNode();
    if (!m_opacityNode) {
        m_opacityNode = new QSGOpacityNode();
        d->extra.value().opacityNode = m_opacityNode;

        QSGNode *child = d->clipNode();
        if (!child)
            child = d->rootNode();
        if (!child)
            child = d->groupNode;

        if (child) {
            if (child->parent())
                child->parent()->removeChildNode(child);
            m_opacityNode->appendChildNode(child);
        }

        d->itemNode()->appendChildNode(m_opacityNode);
    }
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:30,代码来源:qquickanimatorjob.cpp

示例7: Q_ASSERT

void MultiTrackPlotter::setChannelData( int channel, float *data )
{
    Q_ASSERT(channel >= 0 && channel < m_channel_count);

    QSGNode *transformNode = childAtIndex(channel);
    PlotNode1D *plotNode = static_cast<PlotNode1D*>( transformNode->childAtIndex(0) );
    plotNode->setData(data, m_frame_count);
}
开发者ID:jleben,项目名称:quickcollider,代码行数:8,代码来源:oscilloscope.cpp

示例8: deleteContent

 void deleteContent()
 {
     QSGNode *subnode = firstChild();
     while (subnode) {
         // We can't delete the node now as it might be in the preprocess list
         // It will be deleted in the next preprocess
         m_nodes_to_delete.append(subnode);
         subnode = subnode->nextSibling();
     }
     removeAllChildNodes();
 }
开发者ID:bobweaver,项目名称:QtPlugins,代码行数:11,代码来源:mono_text.cpp

示例9: switch

void QSGNodeVisitorEx::visitChildren(QSGNode *node)
{
    for (QSGNode *child = node->firstChild(); child; child = child->nextSibling()) {
        switch (child->type()) {
        case QSGNode::ClipNodeType: {
            QSGClipNode *c = static_cast<QSGClipNode*>(child);
            if (visit(c))
                visitChildren(c);
            endVisit(c);
            break;
        }
        case QSGNode::TransformNodeType: {
            QSGTransformNode *c = static_cast<QSGTransformNode*>(child);
            if (visit(c))
                visitChildren(c);
            endVisit(c);
            break;
        }
        case QSGNode::OpacityNodeType: {
            QSGOpacityNode *c = static_cast<QSGOpacityNode*>(child);
            if (visit(c))
                visitChildren(c);
            endVisit(c);
            break;
        }
        case QSGNode::GeometryNodeType: {
            if (child->flags() & QSGNode::IsVisitableNode) {
                QSGVisitableNode *v = static_cast<QSGVisitableNode*>(child);
                v->accept(this);
            } else {
                QSGGeometryNode *c = static_cast<QSGGeometryNode*>(child);
                if (visit(c))
                    visitChildren(c);
                endVisit(c);
            }
            break;
        }
        case QSGNode::RootNodeType: {
            QSGRootNode *root = static_cast<QSGRootNode*>(child);
            if (visit(root))
                visitChildren(root);
            endVisit(root);
            break;
        }
        case QSGNode::BasicNodeType: {
            visitChildren(child);
            break;
        }
        default:
            Q_UNREACHABLE();
            break;
        }
    }
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:54,代码来源:qsgadaptationlayer.cpp

示例10: m_indexFrom

BindingLoopsRenderPassState::BindingLoopsRenderPassState(const QmlProfilerRangeModel *model) :
    m_indexFrom(std::numeric_limits<int>::max()), m_indexTo(-1)
{
    m_collapsedOverlay = new QSGNode;
    m_collapsedOverlay->setFlag(QSGNode::OwnedByParent, false);
    m_expandedRows.reserve(model->expandedRowCount());
    for (int i = 0; i < model->expandedRowCount(); ++i) {
        QSGNode *node = new QSGNode;
        node->setFlag(QSGNode::OwnedByParent, false);
        m_expandedRows << node;
    }
}
开发者ID:DuinoDu,项目名称:qt-creator,代码行数:12,代码来源:qmlprofilerbindingloopsrenderpass.cpp

示例11: while

QSGNode *QuickSceneGraphModel::currentRootNode() const
{
    if (!m_window)
        return nullptr;

    QQuickItem *item = m_window->contentItem();
    QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
    QSGNode *root = itemPriv->itemNode();
    while (root->parent()) // Ensure that we really get the very root node.
        root = root->parent();
    return root;
}
开发者ID:iamsergio,项目名称:GammaRay,代码行数:12,代码来源:quickscenegraphmodel.cpp

示例12: qsg_simplerenderer_updateRoots

/* Search through the node set and remove nodes that are leaves of other
   nodes in the same set.
 */
QSet<QSGNode *> qsg_simplerenderer_updateRoots(const QSet<QSGNode *> &nodes, QSGRootNode *root)
{
    QSet<QSGNode *> result = nodes;
    foreach (QSGNode *node, nodes) {
        QSGNode *n = node;
        while (n != root) {
            if (result.contains(n)) {
                result.remove(node);
                break;
            }
            n = n->parent();
        }
    }
开发者ID:qtproject,项目名称:playground-scenegraph,代码行数:16,代码来源:simplerenderer.cpp

示例13: while

void QSGNode::removeAllChildNodes()
{
    while (m_firstChild) {
        QSGNode *node = m_firstChild;
        m_firstChild = node->m_nextSibling;
        node->m_nextSibling = 0;
        if (m_firstChild)
            m_firstChild->m_previousSibling = 0;
        else
            m_lastChild = 0;
        node->markDirty(DirtyNodeRemoved);
        node->m_parent = 0;
    }
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:14,代码来源:qsgnode.cpp

示例14: QQuickDefaultClipNode

QSGNode *QQuickTextField::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
    QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
    if (!clipNode)
        clipNode = new QQuickDefaultClipNode(QRectF());

    clipNode->setRect(clipRect().adjusted(leftPadding(), topPadding(), -rightPadding(), -bottomPadding()));
    clipNode->update();

    QSGNode *textNode = QQuickTextInput::updatePaintNode(clipNode->firstChild(), data);
    if (!textNode->parent())
        clipNode->appendChildNode(textNode);

    return clipNode;
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:15,代码来源:qquicktextfield.cpp

示例15: Q_ASSERT

void QSGNode::destroy()
{
    if (m_parent) {
        m_parent->removeChildNode(this);
        Q_ASSERT(m_parent == 0);
    }
    while (m_firstChild) {
        QSGNode *child = m_firstChild;
        removeChildNode(child);
        Q_ASSERT(child->m_parent == 0);
        if (child->flags() & OwnedByParent)
            delete child;
    }

    Q_ASSERT(m_firstChild == 0 && m_lastChild == 0);
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:16,代码来源:qsgnode.cpp


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