Results 1 to 4 of 4

Thread: Change ONLY the background color of a QFrame, not everything in it.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2017
    Posts
    55
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Change ONLY the background color of a QFrame, not everything in it.

    I have a QFrame that I want to change the background color.

    I do so using the following:

    my_qframe->setStyleSheet("background-color:yellow;");

    Which works -- to a point

    I have several buttons in that frame. I do not want their colors changed, but they do change.

    Is there a way around this?

    Thank You

    emp1953

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Change ONLY the background color of a QFrame, not everything in it.

    Quote Originally Posted by emp1953 View Post
    I have a QFrame that I want to change the background color.
    ...
    Perhaps:
    Qt Code:
    1. my_qframe->setStyleSheet("QFrame { background-color:yellow; }");
    To copy to clipboard, switch view to plain text mode 
    Last edited by ChrisW67; 9th January 2020 at 08:21.

Similar Threads

  1. QFrame background color overpaints the content widgets
    By cranberries in forum Qt Programming
    Replies: 3
    Last Post: 12th August 2015, 14:39
  2. How to change the color of background of QMainwindow?
    By weixj2003ld in forum Qt Programming
    Replies: 4
    Last Post: 5th July 2012, 23:56
  3. Change frame background color
    By Ishmael in forum Newbie
    Replies: 1
    Last Post: 7th June 2010, 05:38
  4. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 07:14
  5. how to change QTextEdit background color ?
    By mismael85 in forum Qt Programming
    Replies: 9
    Last Post: 26th June 2008, 22:05

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.