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. How to add multiple lines of text from a single class to a scene [SOLVEÐ]
QtWS25 Last Chance

How to add multiple lines of text from a single class to a scene [SOLVEÐ]

Scheduled Pinned Locked Moved General and Desktop
sceneprinttext
7 Posts 2 Posters 2.5k Views
  • 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.
  • N Offline
    N Offline
    nanoandrew4
    wrote on last edited by nanoandrew4
    #1

    I have been looking around at ways of solving the issue, but haven't found anything yet. What I want is to print speed, altitude, angle, etc... of my plane on the screen, on different lines, but can't manage to print more than one line. Can anyone point to any options I might have to get this done that does not involve creating many classes?

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

      Hi,

      Do you mean a QGraphicsScene ? If so QGraphicsTextItem is probably what you are looking for

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

      N 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Do you mean a QGraphicsScene ? If so QGraphicsTextItem is probably what you are looking for

        N Offline
        N Offline
        nanoandrew4
        wrote on last edited by
        #3

        @SGaist Thank you, just found out that I can make it work with pointers, don't know why it didn't work before.

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

          What do you mean with "with pointers" ?

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

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nanoandrew4
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • N Offline
              N Offline
              nanoandrew4
              wrote on last edited by
              #6

              What I mean by with pointers is I make QGraphicsTextItem *text1 = new QGraphicsTextItem(); and set the text, font and size and add it to the scene.

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

                Ok, so what happened before is that the item you added was destroyed before it could be shown

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

                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