Results 1 to 2 of 2

Thread: Change frame background color

  1. #1
    Join Date
    Sep 2009
    Posts
    41
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Change frame background color

    I would like to change the background color of a frame (on a mouseEnter event). I have tried using
    Qt Code:
    1. this->setStyleSheet("background-color: red");
    To copy to clipboard, switch view to plain text mode 
    but as you can see in the attached image, the formatting gets all messed up. How do I change only the background color, leaving everything else intact?
    Attached Images Attached Images

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change frame background color

    You can mention the class you want to set the stylesheet for, so that it doesnt affect other widgets.
    eg. setStyleSheet(" .QFrame { background-color : red } ");

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

    Ishmael (17th June 2010)

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 10:23
  2. Replies: 2
    Last Post: 21st March 2010, 08:20
  3. Change Color of Focus Frame
    By crybaby in forum Newbie
    Replies: 3
    Last Post: 30th October 2009, 07:02
  4. how to change the color of the frame
    By wagmare in forum Qt Programming
    Replies: 5
    Last Post: 12th May 2009, 12:46
  5. how to change QGroupBox frame color? (Qt4)
    By high_flyer in forum Qt Programming
    Replies: 7
    Last Post: 9th May 2006, 13:48

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.