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. QPlainTextEdit any way to fill line until the widget end?
Forum Updated to NodeBB v4.3 + New Features

QPlainTextEdit any way to fill line until the widget end?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 722 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.
  • T3STYT Offline
    T3STYT Offline
    T3STY
    wrote on last edited by
    #1

    When printing text with less characters than a line could store (say 70 out of 80) I would like to fill the remaining characters (say 10) with whitespaces. I am using a fixed size font although, the widget is not fixed size, so I can't figure in advance how many chars would that be.
    Does QPlainTextEdit provide any functionality to automatically fill until the end of the line?

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

      Hi,

      I'm not aware of such a feature.

      Out of curiosity, what is your use case ?

      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
      • T3STYT Offline
        T3STYT Offline
        T3STY
        wrote on last edited by
        #3

        I am simply printing text messages in a custom debugging console that uses a QPlainTextEdit to show the messages. After some processing I have a final QString to print, which uses HTML formatting to paint the background with a custom color. Unfortunately, if the the string length doesn't cover a full line, the remaining (inexistent) characters will use the normal widget background color instead of the color used for the text background.
        This problem is related to one of my previous threads:
        https://forum.qt.io/topic/53377/qplaintextedit-problems-getting-the-right-way-to-color-items
        As a solution to the thread above, I thought I could fill a line with spaces so it would get fully painted.

        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