Results 1 to 4 of 4

Thread: TextColor in QTextEdit

  1. #1
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default TextColor in QTextEdit

    What is the most efficient way to reset the color of all the text in a QTextEdit? SetTextColor only sets the color of the current format and does not change existing text. Thanks for any help.

  2. #2
    Join Date
    Jun 2010
    Posts
    23
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: TextColor in QTextEdit

    Hey,

    stylesheets would solve your problem. Create a Stylesheet and set it to your QTextEdit.
    Stelios: What the hell are you laughing at?
    Astinos: Well, you had to say it!
    Stelios: What?
    Astinos: "Fight in the shade"!
    -------------------------------------------
    If my answer has helped you, i would appreciate it if you use the thanks button.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: TextColor in QTextEdit

    If you don't have any other format in the text: save the text to a QString, clear the edit and set the text with the new color. Otherwise I guess you have to loop through your text formats.

  4. #4
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: TextColor in QTextEdit

    Thanks. I've tried setting the StyleSheet, but it is overridden by the text formats. Saving and clearing works fine; the only other format was a base font.

Similar Threads

  1. QTextEdit
    By qoo in forum Newbie
    Replies: 6
    Last Post: 28th July 2009, 19:05
  2. QTextEdit
    By veda in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2007, 08:30
  3. Replies: 1
    Last Post: 16th February 2007, 08:22
  4. QTextEdit Help Please
    By Raystorm in forum Newbie
    Replies: 8
    Last Post: 17th May 2006, 05:50
  5. QTextEdit help pls
    By munna in forum Newbie
    Replies: 2
    Last Post: 29th April 2006, 10:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.