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. Drawing text on the screen?
Forum Updated to NodeBB v4.3 + New Features

Drawing text on the screen?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.8k Views 3 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.
  • K Offline
    K Offline
    Krepta
    wrote on last edited by
    #1

    I need to draw graphics and text on the screen. I've googled a bit and people recommended using a transparent widget in which I could override the paintEvent, and so I did, the problem is that I need the things drawn to sometimes move around on the screen relatively fast and that results in stuff like text becoming very hard to read (when calling widget->move(x, y) frequently).
    So I was hoping there might be a better way to do graphics drawing so I can move things like text around without making it blurry, or what you'd call it...?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      One way can be to draw it once on a QImage and then draw that QImage in the paint event. You will have to refresh the QImage when the widget is resized.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      O 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        One way can be to draw it once on a QImage and then draw that QImage in the paint event. You will have to refresh the QImage when the widget is resized.

        O Offline
        O Offline
        ofmrew
        wrote on last edited by
        #3

        @SGaist Why QImage and not QPixmap? Most of what I have read would suggest QPixmap, but you are the expert and, because I have a similar need, that is why I am asking

        1 Reply Last reply
        1
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          QPixmap could also be used in this use case. But since he sounds like
          he plan to alter the image (manipulate) then QImage is suggested.

          https://stackoverflow.com/questions/10307860/what-is-the-difference-between-qimage-and-qpixmap

          O 1 Reply Last reply
          1
          • mrjjM mrjj

            Hi
            QPixmap could also be used in this use case. But since he sounds like
            he plan to alter the image (manipulate) then QImage is suggested.

            https://stackoverflow.com/questions/10307860/what-is-the-difference-between-qimage-and-qpixmap

            O Offline
            O Offline
            ofmrew
            wrote on last edited by
            #5

            @mrjj I read the same item you provided the link to, but I did not get the idea that there was a plan to manipulate the image. If there was no manipulation of the image, just drawing on the display widget, then is one choice better that the other?

            mrjjM 1 Reply Last reply
            1
            • O ofmrew

              @mrjj I read the same item you provided the link to, but I did not get the idea that there was a plan to manipulate the image. If there was no manipulation of the image, just drawing on the display widget, then is one choice better that the other?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @ofmrew
              Say you load an image and paint it over and over on the screen.
              Then QPixmap is said to be faster.
              However, if you load an image and manipulate its pixels ( like color correction) and draw it
              , QImage is more suited.

              1 Reply Last reply
              1
              • K Offline
                K Offline
                Krepta
                wrote on last edited by
                #7

                Thank you all for the help! And yes I needed to manipulate the image, so I went QImage :)
                It's working great so far!

                1 Reply Last reply
                1

                • Login

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