PDA

View Full Version : QPainter::drawEllipse and QTransform strange behaviour



webstar2568
8th March 2011, 15:57
Hi there,

i'm writing an application that should display a pie chart. So I used QPainter::drawEllipse and because it should look a bit more professional, i used QTransform::rotate (as you can see in the code). And then i get this strange result that you can see in the attachment (well, it was difficult to descripe).

What am i doing wrong?

Platform: Kubuntu 10.10, KDE 4.6; Qt 4.7


6053

Code:


QColor color(200,50,50);
QPainter *painter = new QPainter(ui->widget_2);
int h = height();
int w = width();
h = qMin(h,w)/2;
w = qMin(h,w)/2;
QTransform trans;
trans.rotate(-30,Qt::XAxis);
painter->setTransform(trans);
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(color);
painter->setBrush(QBrush(color));
painter->drawEllipse(200,200,200,200);