Results 1 to 2 of 2

Thread: How to change the background color of a QLineEdit?

  1. #1
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default How to change the background color of a QLineEdit?

    I want to distinguish line edits that are set to readonly from the others by changing the background color. This is not obvious.

  2. #2
    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: How to change the background color of a QLineEdit?

    The easiest way is to use style sheets
    css Code:
    1. QLineEdit[readOnly="true"] {
    2. /*...*/
    3. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 11:23
  2. Change frame background color
    By Ishmael in forum Newbie
    Replies: 1
    Last Post: 7th June 2010, 06:38
  3. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 08:14
  4. prob with changing QLineEdit background color
    By Ahmad in forum Qt Programming
    Replies: 2
    Last Post: 30th April 2007, 13:44
  5. background color of QLineEdit
    By Seema Rao in forum Qt Programming
    Replies: 4
    Last Post: 11th December 2006, 21:40

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.