I would like to draw a rectangle with an angle. It works but when I change the angle, location of rectangle is changing somewhere else. I couldnt understand it. Does anybody give me a hand?
Here is my code :
QPoint point = QPoint(100,100); // has to be shown at this point
QSize size = QSize(30,30);
QRect rect = QRect(point,size);
QPainterPath Path ;
Path.addRect(rect);
QTransform t;
t.rotate(myAngle);
QPainterPath newPath= t.map(Path);
QwtPlotShapeItem *Item = new QwtPlotShapeItem( "Shape Name" );
Item->setItemAttribute( QwtPlotItem::Legend, true );
Item->setRenderHint( QwtPlotItem::RenderAntialiased, true );
Item->setShape(newPath );
Item->setPen( Qt::black );
Item->setBrush( QColor("Grey") );
Item->attach(this);
I think map() function cause this problem. But i dont know why. Thanks for advices