Results 1 to 3 of 3

Thread: prob with changing QLineEdit background color

  1. #1
    Join Date
    Mar 2007
    Posts
    16
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default prob with changing QLineEdit background color

    Hi can anyone tell me how can i change the background color of a LineEdit or a Label to another Color???

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: prob with changing QLineEdit background color

    Change the QPalette color for the Window role.

    Regards

  3. The following user says thank you to marcel for this useful post:

    Ahmad (30th April 2007)

  4. #3
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: prob with changing QLineEdit background color

    Quote Originally Posted by marcel View Post
    Change the QPalette color for the Window role.

    Regards
    Something like this
    Qt Code:
    1. QPalette palette;
    2. palette.setColor(widget->backgroundRole(), color);
    3. widget->setPalette(palette);
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to vermarajeev for this useful post:

    Ahmad (30th April 2007)

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 10:23
  2. Dynamically changing QLabel background colour
    By T4ng10r in forum Qt Programming
    Replies: 19
    Last Post: 19th April 2007, 12:47
  3. background color of QLineEdit
    By Seema Rao in forum Qt Programming
    Replies: 4
    Last Post: 11th December 2006, 20:40
  4. QLabel background color
    By munna in forum Newbie
    Replies: 3
    Last Post: 1st May 2006, 15:36
  5. Replies: 2
    Last Post: 10th March 2006, 20:46

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.