[Interest] Drawing dashed line with QSGSimpleMaterialShader

Shawn Rutledge Shawn.Rutledge at qt.io
Mon Jun 6 18:24:31 CEST 2016


> On 6 Jun 2016, at 12:29, Gunnar Sletta <gunnar at sletta.org> wrote:
> 
>> On 06 Jun 2016, at 09:27, Artem Fedoskin <afedoskin3 at gmail.com> wrote:
>> Another question - is there any way to draw text solely in Scene Graph using QSG classes? I need to draw a lot of text labels and what only came to my mind is to draw them using QPainter on a QImage and store it as a QSGSimpleTextureNode in the node itself.
> 
> Nope, the text API is all internally, unfortunately. Going through the QImage + texture node code path shouldn't be too bad though.

It’s not impossible to put text into the scenegraph from C++, but you will need to use private APIs, so you will be tied to a range of Qt versions where those private APIs don’t change.  You can use QTextLayout to generate QGlyphRuns, and create a QSGGlyphNode for each.  Some other QSG stuff is public (and there are examples in qtdeclarative/examples/quick/scenegraph), but QSGGlyphNode isn't.

It may turn out that rendering textures with QPainter, as you suggest, is faster anyway.



More information about the Interest mailing list