Results 1 to 4 of 4

Thread: Change the background color of QTextEdit

  1. #1
    Join Date
    Aug 2009
    Posts
    40

    Change the background color of QTextEdit

    How to Change the background color of QTextEdit,
    Code:
     QColor = QColorDialog:: getColor (Qt:: white, this);
     feild () -> setHtml ( "<html> <body bgcolor= \" #QColor \"> <body> <html>");
    but it does nothing;

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Change the background color of QTextEdit

    You must change the QPalette your textedit and save the color you want in Base or White, or use a stylesheet (see doc) Function setPaper() is not for setting the background color, rather for setting a brush that will draw a complex background (something more complex than a single color).

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: Change the background color of QTextEdit

    Code:
    QColor = QColorDialog:: getColor (Qt:: white, this);
     QTextEdit * Texte = new QTextEdit (this);
     Texte -> setText (Active () -> toPlainText ());
     TextFormatting QString = QString:: fromLatin1 ( "<html> <body %1 bgcolor =>% 2 <body> <html>"). Arg  (QColor. Name ()). Arg (Texte -> toPlainText ());
     Active () -> setHtml (TextFormatting);

  4. #4
    Join Date
    Dec 2008
    Posts
    177

    Re: Change the background color of QTextEdit

    Code:
    setBackgroundRole(QPalette::ColorRole role) in QWidget
    Code:
    setStyleSheet ( "background-color: red;")
    > For a red background ...

Similar Threads

  1. change Metro background color on windows 8
    By Naila in forum Customize Desktop
    Replies: 1
    Last Post: 09-08-2012, 07:30 PM
  2. Unable to change background color of PDF file
    By GurdeepS in forum Windows Software
    Replies: 4
    Last Post: 12-03-2010, 07:22 PM
  3. Change The Background Color Of The Jsp
    By rashmi_ay in forum Software Development
    Replies: 4
    Last Post: 27-02-2010, 08:22 PM
  4. How Can I Change the background Color Of A JOptionPane?
    By Adrina_g in forum Software Development
    Replies: 5
    Last Post: 27-01-2010, 09:41 AM
  5. How to change background color scheme in MSN messenger?
    By Rahman Khan in forum Windows Software
    Replies: 3
    Last Post: 28-03-2009, 05:18 PM

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
  •  
Page generated in 1,713,993,071.18394 seconds with 17 queries