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. Which Widget to use to display simple text lines?
Forum Updated to NodeBB v4.3 + New Features

Which Widget to use to display simple text lines?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.2k Views 2 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.
  • S Offline
    S Offline
    Simmania
    wrote on 13 Mar 2022, 22:34 last edited by
    #1

    Hi,
    I need a Widget to display a number of simple text lines.
    There should be no scrolling.
    I do not need to edit the text.
    It would be nice if I could control line spacing such that a fixed number of lines fits the size of the Widget.

    Is there a Widget suitable for this?
    Or should I draw the strings myself on some canvas or so?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on 13 Mar 2022, 23:06 last edited by mpergand
      #2

      Hi,
      Why not use a QTextView ? QTextEdit of course

      It would be nice if I could control line spacing such that a fixed number of lines fits the size of the Widget.

      For that I'll simply put QLabels in a QVBoxLayout.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Simmania
        wrote on 13 Mar 2022, 23:41 last edited by
        #3

        Isn't QTextView obsolete? I only see the QTextEdit and I do not need edit functionality. I'm afraid this will slow down drawing.

        M S 2 Replies Last reply 13 Mar 2022, 23:45
        0
        • S Simmania
          13 Mar 2022, 23:41

          Isn't QTextView obsolete? I only see the QTextEdit and I do not need edit functionality. I'm afraid this will slow down drawing.

          M Offline
          M Offline
          mpergand
          wrote on 13 Mar 2022, 23:45 last edited by
          #4

          @Simmania
          What about QLabels in a QVBoxLayout. ?

          1 Reply Last reply
          0
          • S Simmania
            13 Mar 2022, 23:41

            Isn't QTextView obsolete? I only see the QTextEdit and I do not need edit functionality. I'm afraid this will slow down drawing.

            S Offline
            S Offline
            SimonSchroeder
            wrote on 15 Mar 2022, 08:10 last edited by
            #5

            @Simmania said in Which Widget to use to display simple text lines?:

            I only see the QTextEdit and I do not need edit functionality. I'm afraid this will slow down drawing.

            An editable widget will only affect drawing while being edited. For QTextEdit you can turn off editing. As long as all your text lines fit on a normally sized screen you don't need to worry about performance much. Most likely there are some tricks to calculate line spacing and apply it to a QTextEdit. But, like others already said, QLabels in a QVBoxLayout are much easier to handle and implement.

            1 Reply Last reply
            0

            1/5

            13 Mar 2022, 22:34

            • Login

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