Hi all!
In my app I use some custom QML element, for simplicity it just a line.

So I overrided QQuickItem::updatePaintNode and inside it I paint my element.

QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 2);
geometry->setDrawingMode(GL_LINES);
geometry->setLineWidth(3);
geometry->vertexDataAsPoint2D()[0].set(0, 0);
geometry->vertexDataAsPoint2D()[1].set(width(), height());

QSGFlatColorMaterial *material = new QSGFlatColorMaterial;
material->setColor(QColor(255, 0, 0));

QSGGeometryNode *node = new QSGGeometryNode;
node->setGeometry(geometry);
node->setFlag(QSGNode::OwnsGeometry);
node->setMaterial(material);
node->setFlag(QSGNode::OwnsMaterial);

But this line looks so ugly. There is no antialiasing at all here.
Ok, I 've looked through QSGDefaultRectangleNode source from /$QTDIR/Src/qtdeclarative/src/quick/scenegraph/ and tried to implement its QSGSmoothColorMaterial instead of QSGFlatColorMaterial but nothing works, I just get segmentation fault. I can't see call stack, just some assembler code so I cannot find the problem line in my code.

So my question is very simple - how can I paint smooth line in custom QQuickItem item? Any advice, example or suggestions will be greatly appreciated!
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to