[SOLVED] Color Gradient for QBrush customization (Qwt Plot Background)
-
wrote on 21 Mar 2012, 17:17 last edited by
So what I am trying to accomplish right now is making a Color Gradient for a QwtPlot canvas background color through code because the colors are going to change dynamically.
So for example: The plot scale for the x axis goes from 0 - 2000
red background from 0 - 500
yellow background from 501 - 750
green background from 750 - 1250
yellow background from 751 - 1500
red background from 1501 - 2000The only way I can think of doing this would be to use a custom QBush using a gradient that does the above. I would like to be able to set the limits of each color though... I looked at the spectrogram example and found some cool color meshing techniques but unfortunately they are unavailable using a straight QwtPlot.
i.e. function
setCanvasBackground(const QBrush &);Any ideas?
-
wrote on 21 Mar 2012, 17:24 last edited by
Have you looked at "QLinearGradient?":http://qt-project.org/doc/qt-4.8/qlineargradient.html
-
wrote on 21 Mar 2012, 17:26 last edited by
exactly what i was looking for, even lets you do multiple colors! and unfortunately google was of no help with pointing me to this gold mine.
Thanks!
1/3