PDA

View Full Version : Change background color of Qcustomplot



emp1953
5th July 2017, 21:07
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

scgrant327
5th July 2017, 21:32
I use:


m_CustomPlot->setBackground(QBrush(QColor("#b3daff")));

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

emp1953
5th July 2017, 23:15
I tried it, it compiles but when running the color does not change. Are there some settings that lock the widgets defaults or something?

scgrant327
6th July 2017, 14:25
You *may* have to do a
->replot to make it work.

Can we see your code?