我创建了自己的Custom QQuickItem,它应该使用QSGGeometry绘制曲线:
curve = new QSGGeometryNode;
curve->setFlag(QSGNode::OwnsMaterial,true);
curve->setFlag(QSGNode::OwnsGeometry,true);
curve->setGeometry(_geometry);
_geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(),_xdata.size());
QSGGeometry::Point2D *points = _geometry->vertexDataAsPoint2D();
for(int i=0;i<_xdata.size();i++) {
points[i].x = _xdata[i];
points[i].y = _ydata[i];
}
_geometry->setLineWidth(2);
_geometry->setDrawingMode(GL_LINE_STRIP);
curve->setGeometry(_geometry);
如何为此曲线启用抗锯齿功能?
答案 0 :(得分:1)
试试这个:
QQuickView view;
QSurfaceFormat format = view.format();
format.setSamples(16);
view.setFormat(format);
view->setSource("...");
view.show();