PDA

View Full Version : multiple color in QPainterPath



edwardc
20th September 2010, 16:54
Folks,

I am trying to draw a multi segment line with different color of each part, is there any ways to do this with QPainterPath ?

Coz there will be hundreds of segments, so that would be great if not using hundreds of path.

-Ed

wysota
20th September 2010, 17:42
QPainterPath only stores shapes, not their properties such as colours.

aamer4yu
20th September 2010, 20:21
QGradient and its subclasses might be of interest to you

edwardc
21st September 2010, 08:10
thanks, i know QPainterPath doesnt maintain any information regarding color.
however, I want drawing a multi-color line into QGraphicsScene for better rotate/zoom in-out handling.

is there any similar approaches ?

wysota
21st September 2010, 08:37
QPainterPath itself has nothing to do with "drawing". If you want to draw something, take a look at QPainter class. There is a QPainter::drawLine() method that is meant to draw lines. You can loop over your set of lines, change pen colours and draw lines.