Home > database >  How to draw an arc between known points to draw XNOR gate in Qt?
How to draw an arc between known points to draw XNOR gate in Qt?

Time:06-14

enter image description here

I want to draw an arc between point E to point G , F to H ( I want to draw XNOR gate symbol ) I tried this way

path.moveTo(72,10); // for E --> G
QRect bound1 (52,10,20,60);
path.arcTo(bound1,90,-180);

QPainterPath path1;  // for F --> H 
path1.moveTo(104,10);
QRect bound2 (72,10,32,60);
path1.arcTo(bound2,90,-180);

and it is currently looking like this.
enter image description here

CodePudding user response:

I think the problem is your QRect. Your hand-drawn picture has the arc E--->G to the right of X coordinate 72. But QRect bound1 starts at 52, not 72. Per the docs

Creates an arc that occupies the given rectangle ... Note that this function connects the starting point of the arc to the current position if they are not already connected.

You don't want the connection part; you just want the arc itself. So the rectangle for E-H must have E and H as the top-left and bottom-left corners.

  • Related