I want to draw an arc between point B to point D and it should touch to point E. ( I want to draw AND gate symbol )
I tried this way
QPainterPath path;
path.arcTo(60,30,46,100,30*16,120*16); // ( x,y,width,height, startAngle,spanAngle)
But it is drawing full circle and not in proper place.
Currently it is looking like this
After getting suggestion I tried like this :
path.moveTo(106, 80);
path.arcTo(76.0, 30.0, 60.0, 100.0, 90.0, -180.0);
How to get rid of that vertical line ( inside AND gate ) ?
Why it is appearing ?
CodePudding user response:
I think you misunderstood the parameters for arcTo, especially the bounding rectangle.
Given your image, you should move path to (106, 80)
(center of the bounding rectangle)
path.moveTo(106, 80)
;
The bounding rectangle of the arc should look like this:
- x: 76
- y: 30
- width: 60
- height: 100
The arc itsel should have a start angle
at 90°
and should span 180°
in negative direction.
This results in:
path.arcTo(76.0, 30.0, 60.0, 100.0, 90.0, -180.0);
Update
path.moveTo(106, 30);
path.cubicTo(QPointF(156.0, 30.0), QPointF(156.0, 130.0), QPointF(106.0, 130.0));