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 - Different color for paragraphs

QPlainTextEdit - Different color for paragraphs

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

    Hello,

    I've searched all questions on this forum about QPlainTextEdit, but i didn't found anything about setting a color for every paragraph.

    In Docs, is written that " Each character within a paragraph has its own attributes, for example, font and color."

    But no info about how to set font and color.

    I use

    void QPlainTextEdit::appendPlainText ( const QString & text )

    to append text, ans i need a different color for every string that i append.

    I need QPlainTextEdit because it's good for logs, or big amount of text, and I need to do a colored log for my program.

    p.s. tried to set palette with different color before appending, but it simply change the color of entire text.

    Any suggestions are welcome.

    Thanks,

    Veaceslav

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MaQzma
      wrote on last edited by
      #2

      You could use "appendHtml":http://doc.qt.nokia.com/4.7-snapshot/qplaintextedit.html#appendHtml

      bq. Appends a new paragraph with html to the end of the text edit.

      Mario.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Veaceslav
        wrote on last edited by
        #3

        Thanks, it works : )

        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