PDA

View Full Version : Qpen, QBrush or QPainterpath problem



jano_alex_es
14th July 2009, 10:08
hi,

I have some items, in my case, arrows, and I'd like to paint a yellow line (using their coords as QPainterPath to paint the lines) but it closes the path at the end.

There is any way to do it with QPainterPath? or will it always close the path at the end? hoy can I do it if I can't use QPainterPath? (please note I need to have my lines joined with the Qt::PenJoinStyle)

The arrows:
http://img106.imageshack.us/img106/4421/soloflechas.jpg

What I want:
http://img217.imageshack.us/img217/2832/deseado.jpg

But PainterPath comes back to its origins :S
http://img263.imageshack.us/img263/3387/why.jpg

Lykurg
14th July 2009, 10:15
It seems to me, that you only have to set Qt::NoBrush on your painter and just use a big pen.

void QPainterPath::addPolygon ( const QPolygonF & polygon )

Adds the given polygon to the path as an (unclosed) subpath.

jano_alex_es
14th July 2009, 11:53
I was already using a big pen... but I didn't know the QBrush has to "fill the holes"; so I just remove it (I just had because in a future I could need design improvements) and it works fine :)

thanks!