Results 1 to 3 of 3

Thread: How to change the default text colour of QTextEdit?

  1. #1
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How to change the default text colour of QTextEdit?

    Hi all,

    I'm using QTextEdit. I want the program to change the text colour randomly with every character I type. So, I will get outputs that look like this:

    abcdefgh abcdefgh abcdefgh

    How to I command QTextEdit to change the "brush color" of the font when I type?

    I just need the code that tells QTextEdit to change colors whenever there's a QTextEdit::textChanged () [signal]

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to change the default text colour of QTextEdit?

    Instead of giving you a fish, we prefer here to teach you how to fish.
    Have a look at QTextEdit::setCurrentCharFormat().
    Ask if you get stuck.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to change the default text colour of QTextEdit?

    Brilliant! That was what I needed. Thanks!

Similar Threads

  1. change the text colour in Menubar
    By chinmayapadhi in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2010, 01:31
  2. Replies: 0
    Last Post: 9th May 2010, 14:14
  3. Replies: 4
    Last Post: 6th April 2010, 00:46
  4. How to change Label text colour in Qt designer
    By sudhansu in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2010, 12:31
  5. How to change Text colour in EditText?
    By phillip_Qt in forum Qt Programming
    Replies: 6
    Last Post: 6th March 2008, 08:48

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.