How to render text in scene graph?
-
Hi,
I am writing a custom QQuickItem with QSGGeometry-based rendering (ie not using QPainter) and I need to render text. Is this possible and how?
I've thought about using Text elements in QML and having my item send signals to position it, but this is extremely brittle and messy and impossible when geometry should be obscuring text, so I want to perform the text rendering using scene graph. I didn't see anything in the docs about how one would do this, however.
-
I had the same issue and finally found out that dynamically instantiating and placing QML Text elements in updatePolish() method does the work pretty well. Don't forget to call polish() whenever your text elements need to be updated though. Also try creating objects only when needed and then only change properties on stored references for better performance.
-
I had the same issue and finally found out that dynamically instantiating and placing QML Text elements in updatePolish() method does the work pretty well. Don't forget to call polish() whenever your text elements need to be updated though. Also try creating objects only when needed and then only change properties on stored references for better performance.