Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to render text in scene graph?
Forum Updated to NodeBB v4.3 + New Features

How to render text in scene graph?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dublindan
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dublindan
      wrote on last edited by
      #2

      Nobody knows how to do this?

      I'd like to avoid manually rendering text in OpenGL, since I don't want to duplicate code (QtQucik already has a text rendering subsystem built in afterall)...

      1 Reply Last reply
      0
      • U Offline
        U Offline
        unai_i
        wrote on last edited by
        #3

        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.

        L 1 Reply Last reply
        0
        • U unai_i

          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.

          L Offline
          L Offline
          literA2
          wrote on last edited by
          #4

          Hi @unai_i, i know this is very old thread, can you please provide simple code on how to render text using updatePolish() in scene graph? Thanks.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved