PDA

View Full Version : Qt-Graphics



grsandeep85
29th October 2009, 07:16
Hi All,

I need to draw a circle which is shown in the attachments, the user will input the center(x, y) and radius from QlineEdits and when the enter key is pressed circle has to draw on a frame for the following case:

1. If the center(x, y) both are positive(refer circle.jpg)
2. If the center(x, y) x=negative, y=positive(refer circle1.jpg)
3. If the center(x, y) x=negative, y=negative(refer circle1.jpg)
4. If the center(x, y) x=positive, y=negative(refer circle1.jpg)

Note: the axis should be displayed.
Even i read the assistant but i didn't get any idea. How to resolve this is issue.

wysota
29th October 2009, 10:40
So what's the problem? What is that you don't know how to do?

grsandeep85
30th October 2009, 06:25
I have drawn horizontal line and vertical line in QFrame using


painter.drawLine(195,395,195,10);//horizontal line
painter.drawLine(385,195,5,195);//vertical line

now the centre of the co-ordinate sytem is (195,195) .

The circle center may be anything but it should fit in the co-ordinate system it may
lie in the 1st,2nd, 3rd or 4th quadrant or may be in the centre.How do i proceed further??

wysota
30th October 2009, 10:33
I still don't get what the problem is... You don't know how to draw a circle? QPainter::drawEllipse() is used to do that.