Answer the question
In order to leave comments, you need to log in
How to draw a triangle in Qt C++?
I work in Qt with the function of drawing shapes.
Please tell me how to draw a triangle and what coordinate formulas it should have in brackets if:
drawLine( lastPoint, endPoint ); this is me drawing the line
drawEllipse( lastPoint, endPoint.x( ) - lastPoint.x( ), endPoint.y( ) - lastPoint.y( )); I draw an ellipse
drawRect( lastPoint.x( ), lastPoint.y( ), endPoint.x( ) - lastPoint.x( ), endPoint.y( ) - lastPoint.y( )); I draw a rectangle
, but the brains do not reach the triangle !!
PS lastPoint - the point where the mouse was pressed on the widget. endPoint.x( ) - end point when stretching a shape (as in Paint)
PS I do it through mouseMoveEvent, mousePressEvent and so on.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question