qt-interest@trolltech.com
[Top] [All Lists]

Re: how to draw arcs in qcanvas ?

Subject: Re: how to draw arcs in qcanvas ?
From: Sumit Nagpal
Date: Mon, 21 Feb 2005 18:05:06 +0530
Thanks.
But drawCubicBezier ignores points more than 4.
So I have made another function simlar to drawCubicBezier but which works on any no. of points.

Sumit Nagpal

Andy Ward wrote:

There is really no need to do that. The way I draw curves is to define a
class such as:

class Curve : public QCanvasPolygonalItem

give this class a property:

QPointArray m_controlPoints;

and drawing the curve is trivial:

void Curve::drawShape(QPainter & p)
{
   p.drawCubicBezier(m_controlPoints);
}

Just remember to implement QPointArray areaPoints() const.

Andy.

----- Original Message -----
From: "Sumit Nagpal" <sumit@xxxxxxxxxxxxxxxxx>
To: <qt-interest@xxxxxxxxxxxxx>
Sent: Thursday, February 17, 2005 9:31 PM
Subject: Re: how to draw arcs in qcanvas ?


yeah i checked it but it makes closed figures whne I pass control points.
But now I have got a solution.
I use Beizer algorithms to generate 100s of points on the curve using my
control points.
Then I draw QCanvasLine between each set of points and the final figure
looks like an ARC.
:)

--Sumit Nagpal

Matthieu Dazy wrote:

Sumit Nagpal wrote:

I think my problem would be solved if I can know the way to make
arcs/curves using QCanvasSpline
Well, have you checked the doc for QCanvasSpline ? It's quite clear
and straightforward.

--
List archive and information: http://lists.trolltech.com/qt-interest/


--
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>