[Qt-interest] trying to rotate ellipse

Caius caius9090 at gmail.com
Fri Mar 18 21:34:14 CET 2011


i tried painter.rotate before draw ellipse but then it didnt draw any ellipse.

Caius



On Mar 18, 2011, at 12:46 PM, Sean Harmer <sean.harmer at maps-technology.com> wrote:

> On Friday 18 March 2011 12:11:13 caius ligarius wrote:
>> Hi I am trying to rotate and ellipse using qpainter rotate fucntion but
>> doesn't seem to work. Here is the code I use-
>> 
>> angle: ellipse orientation(0 to 360 degrees)
>> cenX, cenY: ellipse centre x,y
>> mjAxis, minAxis: major and minor axis of ellipse
>> 
>>        QPen p;
>> p.setColor(color);
>> p.setWidth(2);
>> painter.setPen(p);
>> painter.drawEllipse(QPoint(cenX, cenY), majAxis, minAxis);
>> painter.rotate(angle);
>> painter.restore();
>> 
>> It draws ellipse but doesn't rotate it by "angle" degrees, any ideas?
> 
> You need to rotate the painter before you draw the ellipse. It is too late to 
> rotate it once it has already been drawn.
> 
> Sean
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list