Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Rendering text with QGraphicsScene set to OpenGl

Rendering text with QGraphicsScene set to OpenGl

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k 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.
  • M Offline
    M Offline
    mikesnail
    wrote on last edited by
    #1

    Hi,

    I initially created a QGLWidget which did all my openGl painting. Using that widget I had access to the renderText function which made drawing text trivial.

    Due to the requirements of what I am doing I have now switched to using a QGraphicsView with the viewport set to a QGLWidget. All my OpenGl drawing now takes place in the drawBackground function of the QGraphicsScene, which means I no longer have access to the renderText function.

    Can someone suggest a way to easily drawText within the drawBackground function of the QGraphicsScene?

    Thanks

    Mike.

    1 Reply Last reply
    0
    • keksi venksiK Offline
      keksi venksiK Offline
      keksi venksi
      wrote on last edited by
      #2

      In the draw background method , you can render the text by calling drawText() method .. Along with it you have to set a font for the painter in which the font has reasonable fontstretch and pointsize

      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