PDA

View Full Version : QGradient on triangle



oogolov
20th June 2012, 17:57
Hello,
I need fill instances of QGraphicsPolygonItem (really they are triangles of finite element mesh) using QGragient. I'd like to show stress field in the way. I have stresses in each vertex of mesh that is in each vertex of a triangle. Need I use LinearGradient or RadialGradient? Please help me with triangle gradient or give me a useful referance. Thank you.

wysota
20th June 2012, 18:34
You need to use three linear gradients.

oogolov
20th June 2012, 19:11
I can create three linear gradients along each segment of triangle. Then I will create three brushes using these gradients. But how can I unite three fillings. Need I reimplement QGraphicsItem::paint()? Thank you very much.

wysota
20th June 2012, 19:34
Either clip to the shape of triangle and draw a rectangle over it or draw a polygon.