Results 1 to 4 of 4

Thread: Change background color of Qcustomplot

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

    Default Change background color of Qcustomplot

    The normal color is white. I can change the color in creator via a stylesheet change. I want to change it to yellow if data stops coming into the plot and back to white when data is coming into the plot

    but when I compile and run that color is not on the plot.

    I've tried the palette method and the stylesheet method in code via a button push. The color will not change. Since I promoted a QWidget to qcustomplot does my syntax have to include those items. This one has me frustrated.

    Thanks for any help

    emp1953

  2. #2
    Join Date
    May 2011
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Change background color of Qcustomplot

    I use:

    Qt Code:
    1. m_CustomPlot->setBackground(QBrush(QColor("#b3daff")));
    To copy to clipboard, switch view to plain text mode 

    in C++. See if it works for you.

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

    Default Re: Change background color of Qcustomplot

    I tried it, it compiles but when running the color does not change. Are there some settings that lock the widgets defaults or something?

  4. #4
    Join Date
    May 2011
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Change background color of Qcustomplot

    You *may* have to do a
    Qt Code:
    1. ->replot
    To copy to clipboard, switch view to plain text mode 
    to make it work.

    Can we see your code?

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

    emp1953 (30th April 2019)

Similar Threads

  1. cannot change QStatusBar background color
    By cic in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2013, 17:21
  2. Change background color of a QStackWidget
    By fiodis in forum Newbie
    Replies: 1
    Last Post: 14th December 2012, 09:19
  3. Replies: 1
    Last Post: 17th August 2010, 17:17
  4. Change frame background color
    By Ishmael in forum Newbie
    Replies: 1
    Last Post: 7th June 2010, 06:38
  5. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 08:14

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.