PDA

View Full Version : Drawing an Arrow in QT



gab74
3rd September 2012, 17:06
Hy all,

i've to draw an arrow.

i've the starting point and end point.

No problem to draw the segment, but no ideas to insert arrow head.

How can i add an arrow head to a segment ?

Thanks Gabriele

I try to search on Google but i did not find any code....

d_stranz
3rd September 2012, 17:35
Maybe you didn't Google hard enough. Try this (http://www.codeproject.com/Articles/3274/Drawing-Arrows). It isn't Qt, but what you need is a lesson in geometry - one you understand how the math works, then it is simple to translate the drawing code into the equivalent QPainter method calls.

norobro
3rd September 2012, 18:18
Maybe you didn't Google hard enough.:cool:

Didn't even have to Google. Qt examples: Diagram Scene (http://qt-project.org/doc/qt-4.8/graphicsview-diagramscene.html)

d_stranz
3rd September 2012, 18:29
Qt examples: Diagram Scene

yeah, mo' better.

gab74
3rd September 2012, 19:48
Ok..thanks to all i will study the examples you give me !!!