How to set a bidirectional color gradient
-
Hi everyone,
I'm trying to draw a rectangle with a color gradient. In addition, I need that some sections of the rectangle have different heights. To achieve this what I want to do is something like this:
QLinearGradient grad(0,0,1,0);
grad.setColorAt(0, Color1);
grad.SetColotAt(0.3, Color2);
grad.SetColotAt(0.31, Color3);
grad.setColorAt(1, Color4);and, for example, if i want that the rectangle has 0.5 of height between 0 and 0.3 what I would try to do is define Color1 and Color2 as vertical color gradients where only changes alpha.
Could it be possible to do something like this ??
Thank's for your time!
-
Hi
Yes I think its possible.
You could use the built in editor to experiment. -
It's a good approach, but as the vertical gradient was intended to modify the width of the rectangle it hasn't fitted.
So, what i finally made is create a function which creates little pixmaps from desired height and color gradients and, just after this I paint them into a bigger pixmap