Using a stylish gradient in a QGraphicsItem
-
I am using a QBrush with a QLinearGradient to paint the background of a QGraphicsItem.
It looks ok, but a bit flat. I want it to look more 3 dimensional, which means a non-linear gradient. Something more like this.
Has anyone done this? How did you do it? -
Hi
Im not 100% sure what you ask, but try use the editor and see what you can build.
its quite handy.
-
@AndyBrice
hi
its in Designer
Right click any widget, Change style sheet, Add Gradient (choose some color)
then Edit or New to open editor. -
@AndyBrice
You can drag the handles to make it turn any way you want. -
Thanks.
On investigating a bit more it looks like the nice bitmaps above are a linear gradient, but with multiple 'stops' and some dithering. Might be quite difficult to do with QPainter calls. Perhaps I need to take a small vertical slice and tile that across the rectangle.
-
@AndyBrice
Hi
Im not sure about what part you want to draw with gradient as
for me- the difference between the pic 1n pic 2 is the use of
drop shadow on the buttons so they are not so flat looking. -
Hi
The subtle drop shadow also helps.
if we compare to flat version
However, the gradients were more simple than i though
in the white box, is is just linear between the colors shown. and it really looks the same. (IMHO)