本文整理汇总了C++中QSGGeometryNode::nextSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ QSGGeometryNode::nextSibling方法的具体用法?C++ QSGGeometryNode::nextSibling怎么用?C++ QSGGeometryNode::nextSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSGGeometryNode
的用法示例。
在下文中一共展示了QSGGeometryNode::nextSibling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundingRect
QSGNode * DataSetView::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
if (width() <= 0 || height() <= 0) {
delete oldNode;
return 0;
}
//if(recalculateCellSizes) calculateCellContentSizes();
const QRectF rect = boundingRect();
const int linesPerNode = 1000; //Or something? should be multiple of 2 though
if(!oldNode)
oldNode = new QSGNode();
QSGGeometryNode * currentNode = static_cast<QSGGeometryNode*>(oldNode->firstChild());
for(int lineIndex=0; lineIndex<_lines.size();)
{
if(currentNode == NULL)
{
currentNode = new QSGGeometryNode;
currentNode->setFlag(QSGNode::OwnsMaterial, false);
currentNode->setFlag(QSGNode::OwnsGeometry, true);
currentNode->setMaterial(&material);
oldNode->appendChildNode(currentNode);
}
int geomSize = std::min(linesPerNode, (int)(_lines.size() - lineIndex));
geomSize *= 2;
QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), geomSize);
geometry->setLineWidth(1);
geometry->setDrawingMode(GL_LINES);
QSGGeometry::Point2D *points = geometry->vertexDataAsPoint2D();
for(int geomIndex=0; geomIndex<geomSize; geomIndex+=2)
{
points[geomIndex ].x = _lines[lineIndex].first.x() + rect.left();
points[geomIndex ].y = _lines[lineIndex].first.y() + rect.top();
points[geomIndex+1].x = _lines[lineIndex].second.x() + rect.left();
points[geomIndex+1].y = _lines[lineIndex].second.y() + rect.top();
lineIndex++;
}
currentNode->setGeometry(geometry);
currentNode = static_cast<QSGGeometryNode*>(currentNode->nextSibling());
}
std::queue<QSGGeometryNode*> killThem;
while(currentNode != NULL) //superfluous children! Lets kill em
{
killThem.push(currentNode);
currentNode = static_cast<QSGGeometryNode*>(currentNode->nextSibling());
}
while(killThem.size() > 0)
{
QSGGeometryNode * childToDie = killThem.front();
killThem.pop();
delete childToDie;
}
return oldNode;
}